Sub topic 12
Troubleshooting a DaemonSet
This chapter assumes you can read Pod status with kubectl, know how labels, selectors, and taints work, and have applied the node-log-agent DaemonSet from earlier chapters. The goal is to diagnose a DaemonSet whose DESIRED and READY counts do not match.
Read the status columns first
Start with the DaemonSet itself.
kubectl get daemonset node-log-agent -n kube-systemThe output has these columns:
| Column | Meaning |
|---|---|
| DESIRED | Nodes that should run a Pod, after selectors and taints are applied |
| CURRENT | Pods the controller has created |
| READY | Pods that pass their readiness check |
| UP-TO-DATE | Pods running the latest Pod template |
| AVAILABLE | Ready Pods that have stayed ready long enough |
| NODE SELECTOR | The nodeSelector from the Pod template |
Compare the numbers to decide where to look next.
- DESIRED is lower than your node count: the controller is excluding nodes.
- CURRENT is lower than DESIRED: Pods could not be created.
- READY is lower than CURRENT: Pods exist but are failing, pending, or not ready.
- UP-TO-DATE is lower than DESIRED during an update: a rollout is in progress or stuck.
DESIRED is too low
A node is skipped when it does not match the Pod template. Check three things.
- Node labels against the
nodeSelectoror node affinity:
``bash kubectl get nodes --show-labels ``
- Node taints against the tolerations in the template:
``bash kubectl describe nodes | grep -E "^Name:|Taints:" ``
- The template itself, with
kubectl describe daemonset.
The most common case is control plane nodes. They carry the node-role.kubernetes.io/control-plane:NoSchedule taint, so without a matching toleration the DaemonSet runs on workers only. The node-log-agent manifest includes that toleration. A custom taint added to a worker later needs its own toleration.
Pods are Pending
List the Pods with their nodes.
kubectl get pods -n kube-system -l app=node-log-agent -o wide
kubectl describe pod <pod-name> -n kube-systemThe Events section of describe usually names the cause. Typical messages and fixes:
| Event or symptom | Likely cause | Fix |
|---|---|---|
| `Insufficient cpu` or `Insufficient memory` | The node cannot fit the Pod's requests | Lower requests, free capacity, or set a higher `priorityClassName` for the agent |
| `node(s) had untolerated taint` | A taint has no matching toleration | Add the toleration |
| `didn't match Pod's node affinity/selector` | The node's labels do not match | Fix the labels or the selector |
| `FailedCreate` on the DaemonSet | Quota, admission policy, or a bad template | Run `kubectl describe daemonset` and read the message |
Resource requests matter more for DaemonSets than for Deployments. The same Pod must fit on every selected node, including the smallest one. A priority class lets the scheduler preempt lower-priority Pods to make room for a node agent.
Pods are running but not ready
If Pods are Running but READY is low, the problem is inside the container.
kubectl logs <pod-name> -n kube-system
kubectl logs <pod-name> -n kube-system --previousUse --previous when the container is in CrashLoopBackOff, because it shows the output of the last crashed run. Check these causes:
- A
hostPaththat does not exist or is not readable on that node. - A memory limit too low. The
node-log-agentlimit is 64Mi, and anOOMKilledreason indescribemeans the container exceeded it. - A readiness probe aimed at the wrong port, especially with
hostNetwork: true, where a port conflict with another process on the node can stop the container from starting.
If failures affect only one node, compare that node with a healthy one. Look at its disk, kernel, container runtime, and node conditions with kubectl describe node.
A rollout is stuck
With RollingUpdate, the controller replaces Pods while keeping unavailable Pods within maxUnavailable. One Pod that never becomes ready blocks the rollout.
kubectl rollout status daemonset/node-log-agent -n kube-systemFind the Pod that is not ready, fix the cause, or roll back with kubectl rollout undo. With OnDelete, no Pod updates until you delete it, so a high count of not-up-to-date Pods is expected.
Exercise
A DaemonSet shows DESIRED 5, CURRENT 5, READY 3 on a five-node cluster. Which command shows why the two Pods are not ready, and what would you check first if their status is Pending?
Show answer
Run kubectl get pods -l <label> -o wide to find the two Pods and their nodes, then kubectl describe pod <name> to read the Events. For Pending Pods, check for insufficient CPU or memory on those nodes, untolerated taints, and node selector or affinity mismatches.