How to Check Kubernetes Cluster Health? (Best Practices)
In this article, I will show you how you can check Kubernetes cluster health status.
Here are the following ways you can use it.
- Check cluster API health
- Check Node status
- Check cluster pod status
Kubernetes Cluster Health Check Command
To check the health of the API endpoint, use the following command:
kubectl get --raw='/readyz?verbose'
Now within the cluster, you can use the following command:
curl -k https://localhost:6443/livez?verbose
Additionally, there is a deprecated command for component status that is still functional in the newest release.
kubectl get cs
Kubernetes Node Status Command
Use the below kubectl nodes command to get the status:
kubectl get nodes
Use the following kubectl command to get the status and details of a Kubernetes node in detail.
kubectl describe nodes
How To Check Cluster Pod Status?
Check the status of every cluster pod listed using the kube-system namespace.
kubectl get po -n kube-system
How to check kubernetes cluster health status ubuntu?
Step 1. Check Overall Cluster Status
Run the following command to check if the cluster is up and running:
kubectl cluster-info
It is supposed to return details about the Kubernetes control plane and services.
Step 2. Check Node Status
Ensure all nodes are in a Ready state:
kubectl get nodes
Expected output:
NAME STATUS ROLES AGE VERSION
node-1 Ready master 10d v1.27.1
node-2 Ready worker 10d v1.27.1
If any node is NotReady, troubleshoot further.
Step 3: Verify System Pods (Control Plane Components)
Check if all Kubernetes system pods are running:
kubectl get pods -n kube-system
Look for STATUS=Running and no CrashLoopBackOff or Error.
Step 4: Check Events for Errors
Get recent events to identify issues:
kubectl get events --sort-by=.metadata.creationTimestamp
Step 5: Describe Node for More Details
If a node is unhealthy, run:
kubectl describe node
Look for Warnings or Errors in the output.
Step 6: Check Resource Usage (Optional)
If the metrics server is installed, check resource usage:
kubectl top nodes
kubectl top pods
Step 7: Verify Kubelet Health on Each Node
Log in to a node and check the Kubelet service:
sudo systemctl status kubelet
If it’s inactive or failed, restart it:
sudo systemctl restart kubelet
Step 8: Use Health API (Advanced)
Check the API health endpoint:
curl -s http://localhost:10248/healthz
Expected output: ok
How do you check Kubernetes cluster health status mac?
To check the Kubernetes cluster health status on Mac, follow these steps:
Step 1: Verify Cluster is Running
kubectl cluster-info
This should return details about the control plane and services.
If the cluster is down, it will show an error.
Step 2: Check Node Health
kubectl get nodes
Expected output:
NAME STATUS ROLES AGE VERSION
node-1 Ready master 10d v1.27.1
node-2 Ready worker 10d v1.27.1
If any node shows NotReady, further troubleshooting is needed.
Step 3: Check System Pods (Control Plane Components)
kubectl get pods -n kube-system
Ensure all critical system pods are Running without errors like CrashLoopBackOff or Error.
Step 4: Check for Kubernetes Events
kubectl get events --sort-by=.metadata.creationTimestamp
This will display recent warnings, failures, or scheduling issues.
Step 5: Describe Node for More Details
kubectl describe node <node-name>
Look for warnings or errors related to memory, disk pressure, or network issues.
Step 6. Check Resource Usage (If Metrics Server is Installed)
kubectl top nodes
kubectl top pods
This shows CPU and memory usage.
Step 7: Verify Kubelet is Running on Mac
If you are using Minikube or Kind, check the service status:
- Minikube
minikube status
Ensure that the cluster, control plane, and kubelet are running.
- Kind
docker ps | grep kind
This checks if the Kind cluster containers are running.
Step 8: Check Kubernetes API Health (Advanced)
curl -s http://localhost:10248/healthz
Expected output: ok, If not, the API server might be down.
Final Thoughts Kubernetes Cluster Health Status
In order to make sure the Kubernetes cluster is operating smoothly, it is important to regularly verify the cluster status using several methods.
Check out the CKA exam guide if you’re getting ready for the Kubernetes certification, and take advantage of the CKA coupon code for registration discounts.
Additionally, learning Python for DevOps can be highly beneficial for automating Kubernetes operations, managing infrastructure, and improving workflow efficiency.
Check out the best Kubernetes tutorials if you’re learning the system.
Frequently Asked Questions
How do I check my Kubernetes cluster performance?
To check Kubernetes cluster performance, look at the containers, pods, services, & general cluster characteristics, you may help in the performance of an application in a Kubernetes cluster. Each of these tiers of resources used by an application is thoroughly described by Kubernetes.
What is the command to check node health in Kubernetes?
kubectl get nodes is the command to check the node health in Kubernete.
What is the status code for the Kubernetes health check?
Kubernetes health checks have 3 possible statuses: Success (typically indicated by HTTP 200), Failure (indicated by a non-2xx HTTP status code), and Unknown (when the status cannot be determined). The specific status code used depends on the application’s configuration and needs.