Getting Node Information

Use the kubectl command to display information about nodes in a Kubernetes cluster.

  1. List all cluster nodes.

    To list all nodes in a cluster and the status of each node, use the kubectl get command. This command can be used to list any kind of Kubernetes resource. The following example lists resources that are nodes:

    kubectl get nodes

    The output looks similar to:

    NAME                   STATUS   ROLES           AGE   VERSION
    ocne-control-plane-1   Ready    control-plane   1h    version
    ocne-worker-1          Ready    <none>          1h    version
    ocne-worker-2          Ready    <none>          1h    version
  2. Get details about resources.

    You can get more detailed information about any resource using the kubectl describe command. If you specify the name of the resource, the output is limited to information about that specific resource. Otherwise, details of all resources are displayed. For example, to get detailed information about a specific node:

    kubectl describe nodes ocne-worker-1

    The output looks similar to:

    Name:               ocne-worker-1
    Roles:              <none>
    Labels:             beta.kubernetes.io/arch=amd64
                        beta.kubernetes.io/os=linux
                        kubernetes.io/arch=amd64
                        kubernetes.io/hostname=ocne-worker-1
                        kubernetes.io/os=linux
    Annotations:        flannel.alpha.coreos.com/backend-data: {"VNI":1,"VtepMAC":"3a:41:1a:ce:e0:d0"}
                        flannel.alpha.coreos.com/backend-type: vxlan
                        flannel.alpha.coreos.com/kube-subnet-manager: true
                        flannel.alpha.coreos.com/public-ip: 192.168.122.130
                        kubeadm.alpha.kubernetes.io/cri-socket: unix:///var/run/crio/crio.sock
                        node.alpha.kubernetes.io/ttl: 0
                        volumes.kubernetes.io/controller-managed-attach-detach: true
    ...