How to read nodes in Kubernetes

This quick Kubernetes tip will help you get detailed information about the Kubernetes production node and how to read and understand its output.

What is a Kubernetes Node?

A node is a working machine (virtual / physical) in Kubernetes that runs the pods that host your applications. Services that run on a node include Docker, kubelet, and kube-proxy.

List of available nodes in your Kubernetes cluster

The easiest way to see the nodes available is to use the kubectl command like this:

kubectl get nodes

It should show you all the nodes in your cluster at a glance. You can see the status, role, age and version of each node.

[email protected]:~# kubectl get nodes
NAME          STATUS   ROLES    AGE   VERSION
andreyex    Ready    master   25d   v1.18.8
kworker-rj1   Ready    <none>   25d   v1.18.8
kworker-rj2   Ready    <none>   25d   v1.18.8
[email protected]:~#

As you can see, both worker nodes are in a ready state.

To see more verbose output, run the following command, you can add the -o wide option:

kubectl get nodes -o wide

You will now see additional details such as internal and external IP address, container image, kernel version, and runtime for the container.

[email protected]:~# kubectl get nodes -o wide
NAME          STATUS   ROLES    AGE   VERSION   INTERNAL-IP     EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION       CONTAINER-RUNTIME
andreyex    Ready    master   25d   v1.18.8   127.22.112.200   <none>        Ubuntu 18.04.5 LTS   4.15.0-101-generic   docker://19.3.6
kworker-rj1   Ready    <none>   25d   v1.18.8   127.22.112.201   <none>        Ubuntu 18.04.4 LTS   4.15.0-101-generic   docker://19.3.6
kworker-rj2   Ready    <none>   25d   v1.18.8   127.22.112.202   <none>        Ubuntu 18.04.5 LTS   4.15.0-101-generic   docker://19.3.6

Let’s dive in and find out more about a specific node.

See node description for more details

If you need detailed information about a specific node, you can use the kubectl describe command with the node name:

kubectl describe nodes worker-node-name

Here’s an example of the output:

[email protected]:~# kubectl describe nodes kworker-rj1
Name:               kworker-rj1
Roles:              <none>
Labels:             app=front-end
                    beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/os=linux
                    kubernetes.io/arch=amd64
                    kubernetes.io/hostname=kworker-rj1
                    kubernetes.io/os=linux
                    size=medium
Annotations:        kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
                    node.alpha.kubernetes.io/ttl: 0
                    projectcalico.org/IPv4Address: 127.22.112.201/24
                    projectcalico.org/IPv4IPIPTunnelAddr: 172.16.213.0
                    volumes.kubernetes.io/controller-managed-attach-detach: true
CreationTimestamp:  Sun, 02 Aug 2020 15:42:32 +0000
Taints:             app=front-end:NoExecute
Unschedulable:      false
Lease:
  HolderIdentity:  kworker-rj1
  AcquireTime:     <unset>
  RenewTime:       Fri, 11 Sep 2020 07:09:51 +0000
Conditions:
  Type                 Status  LastHeartbeatTime                 LastTransitionTime                Reason                       Message
  ----                 ------  -----------------                 ------------------                ------                       -------
  NetworkUnavailable   False   Fri, 11 Sep 2020 02:57:12 +0000   Fri, 11 Sep 2020 02:57:12 +0000   CalicoIsUp                   Calico is running on this node
  MemoryPressure       False   Fri, 11 Sep 2020 07:06:56 +0000   Fri, 28 Aug 2020 06:33:29 +0000   KubeletHasSufficientMemory   kubelet has sufficient memory available
  DiskPressure         False   Fri, 11 Sep 2020 07:06:56 +0000   Fri, 28 Aug 2020 06:33:29 +0000   KubeletHasNoDiskPressure     kubelet has no disk pressure
  PIDPressure          False   Fri, 11 Sep 2020 07:06:56 +0000   Fri, 28 Aug 2020 06:33:29 +0000   KubeletHasSufficientPID      kubelet has sufficient PID available
  Ready                True    Fri, 11 Sep 2020 07:06:56 +0000   Fri, 11 Sep 2020 02:56:03 +0000   KubeletReady                 kubelet is posting ready status. AppArmor enabled
Addresses:
  InternalIP:  127.22.112.201
  Hostname:    kworker-rj1
Capacity:
  cpu:                2
  ephemeral-storage:  64800356Ki
  hugepages-2Mi:      0
  memory:             2040812Ki
  pods:               110
Allocatable:
  cpu:                2
  ephemeral-storage:  59720007991
  hugepages-2Mi:      0
  memory:             1938412Ki
  pods:               110
System Info:
  Machine ID:                 c7dbeba40d7b45a387082c96df6cc554
  System UUID:                595C28CA-DBBF-304D-8C5A-7862AA0A60E5
  Boot ID:                    306f36e0-ded3-4b45-946a-89509f845c21
  Kernel Version:             4.15.0-101-generic
  OS Image:                   Ubuntu 18.04.4 LTS
  Operating System:           linux
  Architecture:               amd64
  Container Runtime Version:  docker://19.3.6
  Kubelet Version:            v1.18.8
  Kube-Proxy Version:         v1.18.8
Non-terminated Pods:          (5 in total)
  Namespace                   Name                                    CPU Requests  CPU Limits  Memory Requests  Memory Limits  AGE
  ---------                   ----                                    ------------  ----------  ---------------  -------------  ---
  default                     toleration-demo-dep-54f9ff64b9-7zcrn    0 (0%)        0 (0%)      0 (0%)           0 (0%)         4h9m
  default                     toleration-demo-dep-54f9ff64b9-9sldm    0 (0%)        0 (0%)      0 (0%)           0 (0%)         4h9m
  default                     toleration-demo-dep-54f9ff64b9-rgh7z    0 (0%)        0 (0%)      0 (0%)           0 (0%)         4h9m
  kube-system                 calico-node-2jlhm                       250m (12%)    0 (0%)      0 (0%)           0 (0%)         39d
  kube-system                 kube-proxy-54894                        0 (0%)        0 (0%)      0 (0%)           0 (0%)         22d
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource           Requests    Limits
  --------           --------    ------
  cpu                250m (12%)  0 (0%)
  memory             0 (0%)      0 (0%)
  ephemeral-storage  0 (0%)      0 (0%)
  hugepages-2Mi      0 (0%)      0 (0%)
Events:              <none>

That’s a lot of information. What is important to you?

  • Most of the information is informational, regarding the system’s IP address, hostname, resources (CPU, GPUs, memory), and version information (OS, Docker, Kubernetes).
  • kubelet service status.
  • Unrealizable parameter.
  • In the “Conditions” section, you can indicate if there are problems with system resources that may affect the operation of the application. For example, if any of the OutOfDisk, MemoryPressure, or DiskPressure conditions exist, there are insufficient system resources to serve further workloads.
  • The Events section will finally also display messages that can indicate if there is a problem in the environment.

I hope you enjoy this quick tip on Kubernetes. Stay tuned for updates and don’t forget to subscribe for more.

Sidebar