2
1

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 5 years have passed since last update.

EKS で node とそれが載っている nodegroup 一覧を得る方法

2
Last updated at Posted at 2020-11-27

後続のためのメモ。EKS の (Managed Nodegroup で作られた)ノードには自動で nodegroup-name というラベルが付与されている

$ kubectl describe nodes/ip-10-173-30-116.ap-northeast-1.compute.internal
Name:               ip-10-173-30-116.ap-northeast-1.compute.internal
Roles:              <none>
Labels:             beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/instance-type=m5.large
                    beta.kubernetes.io/os=linux
                    cluster-name=my-cluster
                    eks.amazonaws.com/nodegroup=my-nodegroup
                    eks.amazonaws.com/nodegroup-image=ami-04574e0c4fb2f03fc
                    failure-domain.beta.kubernetes.io/region=ap-northeast-1
                    failure-domain.beta.kubernetes.io/zone=ap-northeast-1a
                    kubernetes.io/arch=amd64
                    kubernetes.io/hostname=ip-10-173-30-116.ap-northeast-1.compute.internal
                    kubernetes.io/os=linux
                    nodegroup-name=my-nodegroup

なので kubectl get nodes に -L nodegroup-name を付けてそのラベルも出力してあげれば一覧を取れる

$ kubectl get nodes -L nodegroup-name
NAME                                               STATUS   ROLES    AGE   VERSION                NODEGROUP-NAME
ip-10-173-30-116.ap-northeast-1.compute.internal   Ready    <none>   61d   v1.16.12-eks-904af05   my-nodegroup
ip-10-173-35-117.ap-northeast-1.compute.internal   Ready    <none>   15h   v1.16.12-eks-904af05   my-nodegroup
ip-10-173-57-100.ap-northeast-1.compute.internal   Ready    <none>   11h   v1.16.12-eks-904af05   another-nodegroup

なお、GKEの場合はノード名がノードプール名からそれっぽく自動生成されるため、ノード名だけ見れば大体わかる。こういう機能が欲しいと思ったこと自体がない。

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?