2.3.1 ノードに関する情報の取得

クラスタ内のすべてのノードおよび各ノードのステータスのリストを取得するには、kubectl getコマンドを使用します。このコマンドは、Kubernetesでサポートされるあらゆる種類のリソースのリストを取得するために使用できます。この例では、nodesリソースは次のように示されます。

$ kubectl get nodes
NAME                   STATUS    ROLES   AGE      VERSION
master.example.com     Ready     master  1h       v1.17.x+x.x.x.el7
worker1.example.com    Ready     <none>  1h       v1.17.x+x.x.x.el7
worker2.example.com    Ready     <none>  1h       v1.17.x+x.x.x.el7

いずれかのリソースに関する詳細情報を取得するには、kubectl describeコマンドを使用します。リソースの名前を指定した場合、出力は、そのリソースのみに関する情報に制限されます。それ以外の場合は、すべてのリソースの完全な詳細も画面に出力されます。

$ kubectl describe nodes worker1.example.com
Name:               worker1.example.com1
Roles:              <none>
Labels:             beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/os=linux
                    kubernetes.io/arch=amd64
                    kubernetes.io/hostname=worker1.example.com
                    kubernetes.io/os=linux
Annotations:        flannel.alpha.coreos.com/backend-data: {"VtepMAC":"fe:78:5f:ea:7c:c0"}
                    flannel.alpha.coreos.com/backend-type: vxlan
                    flannel.alpha.coreos.com/kube-subnet-manager: true
                    flannel.alpha.coreos.com/public-ip: 192.0.2.11
                    kubeadm.alpha.kubernetes.io/cri-socket: /var/run/crio/crio.sock
                    node.alpha.kubernetes.io/ttl: 0
                    volumes.kubernetes.io/controller-managed-attach-detach: true
...