1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AWS EKS on Fargateでpodが使用しているvCPU, Memoryを表示するワンライナー

Last updated at Posted at 2021-09-16

AWS EKS on Fargete では主にPodをホスティングしているFargateのvCPU memory に課金がされます。

各podが使用しているvCPU memorykubectl describe pods で取得できる、Annotations: CapacityProvisioned にて確認することができます

$ kubectl describe pods
Name:                 hogehoge
Namespace:            default
Priority:             2000001000
Priority Class Name:  system-node-critical
Node:                 fargate-ip-xxxx.ap-northeast-1.compute.internal/xxxx
Start Time:           Tue, 14 Sep 2021 13:00:51 +0900
Labels:               app=hogehoge
                      eks.amazonaws.com/fargate-profile=fp-default

Annotations:          CapacityProvisioned: 0.25vCPU 0.5GB

                      Logging: LoggingDisabled: LOGGING_CONFIGMAP_NOT_FOUND
                      kubernetes.io/psp: eks.privileged

またdescribe pods以外にもkubectl get pods -o json でJSON形式でpodごとの情報を出力することができるので、jq と組み合わせて以下のように取得することができます

$ kubectl  get pods --all-namespaces -o json \
  | jq -r '.items | .[] | [.metadata.name, .metadata.annotations.CapacityProvisioned]   | @tsv' \
  | grep vCPU 

hogehoge	0.25vCPU 0.5GB
aws-load-balancer-controller-75887bfdc9-tbl27	0.25vCPU 0.5GB
coredns-859bbbb85d-vdw97	0.25vCPU 0.5GB
coredns-859bbbb85d-wbw9p	0.25vCPU 0.5GB

kube-system で動くようなpodにも課金されるので注意が必要です


1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?