To check the overall status of the Kubernetes cluster, we need to check the status of all the nodes that are part of the cluster. This includes, health, CPU utilization and memory utilization.
How to find the details of the cluster and worker nodes ?
The following commands will help you to find these details using kubectl.
kubectl get nodes
The above command will list all the nodes that are part of the cluster and also its status. The screenshot of sample response is given below. The following screenshot is the details of a 10 node Azure Kubernetes cluster ( AKS ) .
To get the complete details of all the nodes in the cluster with the IP Address, use the following command.
kubectl get nodes -o wide
The screenshot of the sample out is given below.
The details includes
- Node name
- Status of agent
- Node IP Address
- Operating system details
- Kernel version
- Docker details
- External IP (if any)
How to find the Memory and CPU utilization of nodes in a Kubernetes cluster ?
It is very important to check the memory and CPU utilization of worker nodes in a Kubernetes cluster. This will help us to check the overall resource utilization of the cluster and decide to scale up or down the cluster.
The command to get the CPU and memory utilization of Kubernetes cluster is given below.
kubectl top nodes
The screenshot of sample output is given below.
From the above screenshot, we can see the following details
- Node name
- CPU utilization in cores
- CPU utilization in percentage
- Total memory utilization in bytes
- Total memory utilization percentage
I hope the above tips are helpful. Follow the blog to get frequent updates. Feel free to comment if you have any questions.