Five kubectl commands let you tell whether a Kubernetes cluster is healthy. This guide shows you how to check node status, detect resource pressure, read CPU and memory usage and browse the cluster events. You can then spot a problem before it affects your applications.
What you will learn
- Check that all nodes are Ready and interpret their conditions
- Read the allocated resources vs capacity of a node
- Install metrics-server to enable
kubectl top - Monitor CPU and memory usage in real time
- Analyze events to spot anomalies
Prerequisites
- A working Kubernetes cluster (v1.37)
kubectlconfigured and connected to the cluster- Read access to the cluster's nodes, pods, events and metrics
- Basic knowledge of Pods and Kubernetes nodes
How does Kubernetes monitor node health?
The kubelet (the agent that runs on every node) updates the node's status
and regularly renews a Lease object in the kube-node-lease namespace. If
the control plane stops receiving these signals, it can mark the node as
unreachable (Ready: Unknown) after about 40 seconds by default, then wait
5 minutes before starting the first eviction of the node's pods.
Concretely, the kubelet updates two things:
- The node status (
.status.conditions): several conditions that report resource pressure, notablyReady,MemoryPressure,DiskPressure,PIDPressureand, depending on the context,NetworkUnavailable - A Lease object in
kube-node-lease: a lightweight "I am alive" signal that serves as a fast heartbeat
When a condition turns True, the node is reporting a problem. The only
exception is Ready, which must stay True. And when Ready turns
Unknown, the control plane has lost contact.
| Condition | Healthy state | What it means when abnormal |
|---|---|---|
Ready | True | False = failing kubelet or node; Unknown = unreachable node |
MemoryPressure | False | Available memory is below the eviction thresholds |
DiskPressure | False | Pressure on nodefs, imagefs or inodes, depending on the kubelet configuration |
PIDPressure | False | Not enough PIDs available |
NetworkUnavailable | False | Node network not ready, depending on the provider/CNI |
Step 1: check node status
The first command to run is kubectl get nodes. It gives a quick overview of
every node in the cluster:
kubectl get nodesAll nodes must show Ready in the STATUS column:
NAME STATUS ROLES AGE VERSIONks-cp1 Ready control-plane 41h v1.37.0ks-worker1 Ready <none> 41h v1.37.0ks-worker2 Ready <none> 41h v1.37.0For more detail (IP, runtime, OS), add -o wide:
kubectl get nodes -o wide| Status in the output | Meaning | Action |
|---|---|---|
Ready | The node works normally | None |
NotReady | The Ready condition is not True; the cause is read in step 2 | Display the node conditions with kubectl describe node |
SchedulingDisabled | The node is cordoned | Normal during planned maintenance |
A NotReady status does not explain the failure. The next step looks for its
cause.
Step 2: inspect a node's conditions
Step 1 tells you whether a node is ready. The node conditions, which
kubectl describe node displays, tell you what is wrong when it is not.
What does the NotReady status really say?
The NotReady status means that the node's Ready condition is not True:
the node is not ready to accept pods. It does not say why. To look for the
cause, display the node details with kubectl describe node:
kubectl describe node ks-worker1The output is long. On a NotReady node, look at the Ready line of the
Conditions section: its Reason and Message columns give the first lead.
When the kubelet stops giving any sign of life, Ready is Unknown and the
message reads Kubelet stopped posting node status.
Does a healthy node have all its conditions at True?
No. On a healthy node, only Ready is True: the other conditions signal
a problem when they turn True, so they must stay False. Here is the
Conditions section of a healthy node:
Conditions: Type Status Reason Message ---- ------ ------ ------- NetworkUnavailable False CalicoIsUp Calico is running on this node MemoryPressure False KubeletHasSufficientMemory kubelet has sufficient memory available DiskPressure False KubeletHasNoDiskPressure kubelet has no disk pressure PIDPressure False KubeletHasSufficientPID kubelet has sufficient PID available Ready True KubeletReady kubelet is posting ready statusEach line of this table reads as follows:
Ready: True= the kubelet works and accepts podsMemoryPressure: False= memory is sufficientDiskPressure: False= enough disk spacePIDPressure: False= number of processes within limits
How do I check allocated resources?
Further down in the describe node output, the Allocated resources
section adds up the requests and the limits of the pods on this node that have not terminated, and reports them against the node's allocatable capacity:
Allocated resources: Resource Requests Limits -------- -------- ------ cpu 455m (32%) 7 (500%) memory 432730Ki (38%) 4501513472 (390%)Requests represent what the pods have reserved. Limits are the maximum they can use. When Requests approach the allocatable capacity, the node can no longer accept new pods. An alert threshold around 80% is common, to be adapted to your cluster.
Limits that add up to more than 100% of the capacity are normal: this is
not a configuration defect. The pods could exceed the node's capacity if
they all used their ceiling at the same time, which rarely happens. Watch the
Requests instead, since they are what the scheduler reserves.
Step 3: check control plane health
The control plane (API server, scheduler, controller-manager, etcd) drives the cluster. The API server exposes two dedicated health endpoints.
What are the /readyz and /livez endpoints?
Since Kubernetes v1.16, two endpoints replace the old /healthz:
/livez: is the API server process alive?/readyz: is the API server ready to serve requests?
kubectl get --raw='/readyz?verbose' | head -20Each [+] line confirms a working subsystem:
[+]ping ok[+]log ok[+]etcd ok[+]poststarthook/start-apiserver-admission-initializer ok[+]poststarthook/generic-apiserver-start-informers ok...If a line shows [-], the matching subsystem is failing.
To check liveness as well:
kubectl get --raw='/livez?verbose' | head -20How do I check the control plane pods?
To see concretely whether the control plane components are running:
kubectl get pods -n kube-system -o wideCheck that the etcd, kube-apiserver, kube-controller-manager and
kube-scheduler pods are Running with RESTARTS at 0.
Two commands from older runbooks are to be dropped: /healthz, deprecated since v1.16 in favor of /readyz and /livez, and kubectl get componentstatuses, deprecated since v1.19. They still answer on many clusters, but they give an answer without guaranteeing that it reflects the real state.
Step 4: monitor usage with metrics-server
The kubectl top command displays CPU and memory usage in real time. It
requires metrics-server, a component that collects metrics from each
kubelet and feeds the Metrics API used, among others, by the autoscalers
(HPA/VPA).
If kubectl top nodes answers error: Metrics API not available, the most common cause is that metrics-server is not installed. It is not a component shipped with Kubernetes, and it is missing on most test clusters, kind included. The next section shows how to add it.
How do I install metrics-server (lab only)?
Expand the installation steps
-
Apply the official manifest:
Terminal window kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.9.1/components.yaml -
On a cluster without a TLS certificate (such as a lab), add the
--kubelet-insecure-tlsflag:Terminal window kubectl -n kube-system patch deployment metrics-server --type=json \-p='[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-insecure-tls"}]' -
Wait until metrics-server is ready:
Terminal window kubectl -n kube-system rollout status deployment/metrics-server --timeout=90s -
Check that the Metrics API is available:
Terminal window kubectl get apiservices | grep metricsExpected result:
v1beta1.metrics.k8s.io kube-system/metrics-server True 59s
How do I read node usage?
Once metrics-server is installed, the kubectl top nodes command displays
real usage:
kubectl top nodesNAME CPU(cores) CPU(%) MEMORY(bytes) MEMORY(%)ks-cp1 131m 9% 1129Mi 102%ks-worker1 72m 5% 833Mi 75%ks-worker2 74m 5% 935Mi 85%The four columns read as follows:
- CPU(cores): instantaneous consumption in millicores (1000m = 1 CPU)
- CPU%: percentage of the allocatable capacity
- MEMORY(bytes): memory actually used (working set)
- MEMORY%: percentage of the allocatable memory
How do I read pod usage?
kubectl top pods -A --sort-by=cpu | head -15This command sorts all pods by decreasing CPU usage and quickly shows which one consumes too much.
For a specific namespace:
kubectl top pods -n kube-systemmetrics-server collects measurements at a regular interval, every 60 seconds by default (the --metric-resolution option). A freshly created Pod can therefore take more than a minute to appear in kubectl top. A Pod missing from the output is therefore not necessarily a failing Pod.
kubectl top gives a snapshot, with no history and no alerting: it is for sorting quickly, not for understanding a drift. To find out since when a pod consumes too much, or whether the situation is getting worse, you need a complete observability stack, Prometheus and Grafana for example.
Step 5: read the cluster events
Kubernetes events record what happens in the cluster: creations, scheduling errors, restarts, evictions.
How long does Kubernetes keep events?
One hour by default. The API server keeps them only for that time, which you
can change with the --event-ttl option of kube-apiserver: an older incident
no longer appears in the list. The absence of an event therefore proves
nothing: a pod that crashed two hours ago has no trace left here, and that
does not mean everything was fine. Beyond one hour, your monitoring and the
kubelet logs keep the trace. Check the events as soon as you notice a problem.
How do I display recent events?
Since Kubernetes v1.26, the kubectl events subcommand offers a more readable
display with native filtering options. To see recent warnings:
kubectl events -A --types=WarningThe classic kubectl get events command remains available for sorting
(--sort-by) and for finer filtering (--field-selector). The guide
Analyze Kubernetes events
covers these options in detail:
kubectl get events -A --sort-by=.metadata.creationTimestamp | tail -20Filtering by resource is often more direct than reading the whole list:
kubectl events -A --for=node/ks-worker1kubectl events -n default --for=pod/mon-podThe event type separates normal operation from anomalies:
| Event type | Examples | Meaning |
|---|---|---|
Normal | Pulling, Created, Started | Normal kubelet operations |
Warning | FailedScheduling, BackOff, Unhealthy | Something is not working |
Which common events should I watch?
Here are five frequent events. For each one, the table gives the likely cause and the first thing to do.
| Event | Likely cause | Action |
|---|---|---|
FailedScheduling | Not enough resources on the nodes | Check kubectl describe node, free up resources |
BackOff | The container restarts in a loop, which kubectl get pods displays as CrashLoopBackOff | Check the logs: kubectl logs <pod> |
FailedMount | Volume not available | Check the PVC and the StorageClass |
Unhealthy | The probe failed | Check the probes configuration |
Evicted | Node under pressure (memory/disk) | Check the node conditions |
Summary: the 5 essential commands
Run these five commands in this order, from the widest check (node status) to the most precise (events). Each command rules out a family of causes before the next one. If all five pass, the cluster infrastructure is probably healthy and the problem is more likely on the application side.
| # | Command | What it checks |
|---|---|---|
| 1 | kubectl get nodes | All nodes are Ready |
| 2 | kubectl describe node <name> | Detailed conditions and allocated resources |
| 3 | kubectl get --raw='/readyz?verbose' | Control plane health |
| 4 | kubectl top nodes / kubectl top pods | Real-time CPU/memory usage |
| 5 | kubectl events -A --types=Warning | Recent anomalies in the cluster |
Going beyond the five commands: internal metrics
The five commands above are enough to triage quickly. When kubectl top is no longer enough, the kube-apiserver and the kubelet expose /metrics endpoints in Prometheus format.
What metrics does the kube-apiserver expose?
Prometheus collects these metrics, but nothing forces you to
deploy Prometheus to read them: kubectl get --raw queries the
endpoint directly and prints raw text. It is a quick way to check that a
metric exists under the name you think it has, before writing a PromQL query.
# Global control plane metricskubectl get --raw /metrics | grep -E "^# HELP (apiserver|etcd_)" | headA few useful metrics:
| Metric | What it indicates |
|---|---|
apiserver_request_duration_seconds | API request latency (by verb and resource) |
apiserver_request_total | Total number of API requests (useful to spot an activity spike) |
etcd_request_duration_seconds | Latency of calls to etcd |
etcd_bookmark_total | Number of etcd bookmarks emitted (renamed in 1.36, see below) |
What metrics do the kubelet and cAdvisor expose?
The kubelet exposes its own metrics, separate from those of the API server. Everything about the node's containers and their resources comes from the kubelet, and is read through the API proxy.
NODE=$(kubectl get nodes -o jsonpath='{.items[0].metadata.name}')
# Kubelet's own metricskubectl get --raw "/api/v1/nodes/${NODE}/proxy/metrics" | grep -E "^# HELP" | head
# cAdvisor metrics (per container)kubectl get --raw "/api/v1/nodes/${NODE}/proxy/metrics/cadvisor" | grep -E "^# HELP" | headHow do I measure node pressure with PSI (GA in 1.36)?
Since Kubernetes 1.36, PSI metrics (Pressure Stall Information) are GA. Through cgroup v2, they expose the time during which a container's tasks have waited or been blocked for lack of CPU, memory or IO. It is a finer indicator than simple average utilization.
kubectl get --raw "/api/v1/nodes/${NODE}/proxy/metrics/cadvisor" \ | grep -E "^container_pressure_(cpu|memory|io)_(stalled|waiting)"The six exposed metrics:
| Metric | Meaning |
|---|---|
container_pressure_cpu_waiting_seconds_total | Tasks waiting for CPU |
container_pressure_cpu_stalled_seconds_total | All non-idle tasks blocked at the same time by the CPU |
container_pressure_memory_waiting_seconds_total | Memory pressure (allocation/swap) |
container_pressure_memory_stalled_seconds_total | All non-idle tasks blocked at the same time by memory |
container_pressure_io_waiting_seconds_total | IO wait |
container_pressure_io_stalled_seconds_total | Total IO stall |
A *_stalled_seconds_total counter whose rate of increase goes up (the PromQL rate()) shows that the container spends more and more time blocked on the matching resource, with all its non-idle tasks at once. For memory, this can precede an OOMKill, but the Kubernetes documentation does not state it: read this counter as a sign of strain, not as a prediction.
Which metrics were renamed in 1.36?
If you have long-standing Grafana dashboards or Prometheus alert rules, two metrics were renamed in Kubernetes 1.36:
| Before (≤ 1.35) | After (1.36+) |
|---|---|
volume_operation_total_errors | volume_operation_errors_total |
etcd_bookmark_counts | etcd_bookmark_total |
Adjust your PromQL queries and dashboards after a version upgrade: without that, they will show empty series, without any warning.
Pay attention to where you look: these two metrics are not exposed by the same component, and a metric searched on the wrong component returns an empty result, which looks like a vanished metric. etcd_bookmark_total comes from the API server, and is read like this:
kubectl get --raw /metrics | grep etcd_bookmark_totalThe volume_operation_* metrics, on the other hand, come from the kube-controller-manager (the persistent volume controller), and cannot be found on the API server or on the kubelet. They are read on that component's /metrics endpoint, which Prometheus usually queries.
Troubleshooting
This table lists the symptoms you will meet when reading a cluster's health.
Two of them do not signal any failure: a kubectl top that does not answer
often means that metrics-server is not installed, and a missing metric
often means that you are looking for it on the wrong component. Check these
two causes before opening an investigation on a cluster that may well be fine.
| Symptom | Likely cause | Solution |
|---|---|---|
Node NotReady | Kubelet, runtime or network plugin failing (False), or node unreachable (Unknown) | Log in to the node, check systemctl status kubelet |
MemoryPressure: True | Not enough memory | Identify the hungry pods with kubectl top pods, add memory or reduce the load |
DiskPressure: True | Disk full (images, logs) | Clean unused images: crictl rmi --prune |
kubectl top returns "Metrics API not available" | metrics-server missing | Install metrics-server (see step 4) |
/readyz shows [-]etcd | etcd unavailable | Check the etcd pod: kubectl logs -n kube-system etcd-<name> |
| A metric stays missing (empty result) | Wrong component queried, or pre-1.36 name | Query the right /metrics endpoint (API server, kubelet or kube-controller-manager) and check the name (see "Which metrics were renamed in 1.36?") |
Many Evicted events | Node under prolonged pressure | Add nodes or reduce the workload |
Hands-on practice
You have just read a cluster's health command by command. In this lab, the kubeadm cluster has no metrics-server, so kubectl top returns nothing. You install metrics-server from the pinned manifest provided and make it accept the kubelets' certificates. You then write a health report in the bulletin ConfigMap of the sante namespace, naming the Pod that uses the most memory and the node whose CPU is the most reserved by requests.
The validation checks three requirements: the Metrics API is available and kubectl top nodes answers, the report names the Pod of sante that uses the most memory as kubectl top measures it, and it names the node whose allocatable CPU is the most reserved by requests. If a requirement fails, go back to step 4 for kubectl top, or to step 2 for per-node reservations (Allocated resources).
Key takeaways
kubectl get nodesis your first reflex: all nodes must beReady- The conditions of a node (
Ready,MemoryPressure,DiskPressure,PIDPressureand, depending on the context,NetworkUnavailable) sum up its health kubectl describe nodereveals allocated resources vs capacity, so watch the Requests/Allocatable ratio- metrics-server is required for
kubectl top, and Kubernetes does not install it by itself - Warning events report recent anomalies: Kubernetes keeps them for only one hour by default, so check them without delay
- These commands give a snapshot; for continuous monitoring, deploy Prometheus and Grafana
- A missing metric does not prove it disappeared: check that you are querying the right component and the new name after a version upgrade
Knowledge check
Seven questions cover three reading traps: the Ready condition, the only
one that must be True, Limits above 100% that are not a defect, and
a missing metric because you query the wrong component.
Knowledge check
Check what you have learned with this interactive quiz
How it works
- The timer starts when you click Start
- Multiple choice, true/false and short answer questions
- You can move between questions
- Detailed results are shown at the end
Starts the quiz and the timer
Review
(0/0)Result saved on this device. It will be sent to your account at the next sync. Sync now
Score by domain
A domain groups several guides and gets several questions, so its score is more reliable than a per-topic score, which often rests on a single question.
Summary
Strengths
No topic passed at 80% on at least two questions yet.
Weak areas
No topic below the pass mark.
Recommended next
Hints before you try again?
Continue the course: PromQL: the Prometheus query language
A new full quiz with random questions
Work again only on the questions you missed