DaemonSet in Kubernetes
Learn how Kubernetes places exactly one helper on every machine in the cluster, automatically, including machines that join tomorrow. Explained from zero with everyday analogies, diagrams and real-world examples.
Picture a large hotel chain with hundreds of branches. Head office decides that every branch must have a fire alarm, a security guard at the entrance and a cleaning supervisor. Head office does not want to write to each branch, ask “have you hired a guard yet?” and chase the answers. It wants a rule that says: every branch, always, exactly one guard. When a new branch opens, a guard appears there automatically. When a branch closes, its guard goes with it.
A DaemonSet is that rule for Kubernetes. Some programs are not meant to run “three copies somewhere in the cluster.” They must run exactly once on every machine, such as a program that collects logs or measures the health of each computer. A DaemonSet guarantees it, and keeps guaranteeing it as machines come and go.
This guide assumes you know nothing. Every new word is explained the first time it appears, and each big idea comes with an analogy from normal life. By the end you will understand what a DaemonSet is, why it exists, how it works inside, how to target only some machines, how to update it safely and how to avoid common mistakes.
1The Problem: Some Jobs Belong on Every Machine
To understand any tool, first understand the pain that made someone invent it.
A quick refresher
Kubernetes is a system that runs your applications across many computers. Each computer in the group is called a node, and the whole group is a cluster. Your applications run inside pods, which are small wrappers around one or more containers. Normally, you tell Kubernetes “run three copies of my web application,” and it picks any nodes it likes.
But some programs are node helpers
Certain programs are not about your application at all. They are about the machine itself. Think about what a busy operations team needs from every node in the cluster.
Collect logs
Every node produces log files from the pods on it. Someone must gather them from each machine and ship them to a central place.
Measure health
Processor, memory, disk and network use must be measured on every machine, not just on a few of them.
Connect the network
Each node needs a network helper so that its pods can talk to pods on other nodes.
Watch for threats
Security tools must observe activity on every machine, otherwise an attacker simply picks the unwatched one.
Why ordinary tools fall short
A Deployment, the usual manager for everyday applications, lets you say “keep N copies.” But it decides freely where they go. It might put two copies on one node and none on another. Even if you set N equal to the current number of nodes, the moment a node is added or removed, the count is wrong, and somebody has to remember to change it.
Doing this by hand is a recipe for gaps. The one node without a log collector is the one where the problem happens, and nobody sees it.
Imagine a school where every classroom must have a first-aid box. If the head teacher relies on someone remembering to place a box in each new classroom, sooner or later a room is missed. A rule that says “every classroom gets one, automatically” removes the human memory from the process.
Many beginners think a DaemonSet is used for “important” applications. It is not about importance. It is about placement: one pod per node. A small helper agent may be a perfect DaemonSet while a critical payment service is not.
2So, What Exactly Is a DaemonSet?
A DaemonSet is a Kubernetes object that ensures a copy of a pod runs on all, or a chosen group of, nodes in the cluster.
Let us unpack that. A Kubernetes object is a record you store in the cluster describing something you want. A copy of a pod means one pod built from a template you provide. All nodes, or a chosen group means the default is every node, but you can narrow it using labels and rules, such as only nodes with graphics cards.
The word daemon comes from the Unix world. A daemon is a background program that quietly does a supporting job without any user interacting with it, like a print spooler or a clock updater. A DaemonSet is a set of such background programs, one per machine.
Think of the caretaker in each block of flats in a housing society. The society does not decide “we need five caretakers somewhere.” It decides “each block has one caretaker.” New block built, new caretaker assigned. Block demolished, caretaker released. A DaemonSet is the society’s rule and the caretakers are its pods.
The behaviour in four sentences
A node exists, so a pod appears
When you create a DaemonSet, Kubernetes puts one pod on every eligible node in the cluster.
A new node joins, so a pod is added
The moment a fresh machine registers with the cluster, a pod is created for it, with no human action.
A node leaves, so its pod is cleaned up
When a node is removed, the pod that ran on it is garbage-collected. It is not moved elsewhere, because another pod already exists on every remaining node.
The DaemonSet is deleted, so all its pods go
Removing the DaemonSet removes every pod it created, unless you deliberately ask to keep them.
flowchart TB
DS[DaemonSet: log collector]
DS --> N1[Node 1 with one collector pod]
DS --> N2[Node 2 with one collector pod]
DS --> N3[Node 3 with one collector pod]
NEW[New Node 4 joins] -.->|pod added automatically| DS
3DaemonSet Compared With Its Neighbours
Kubernetes offers several managers for pods. Choosing the right one is half the skill.
| Manager | Controls Count By | Placement | Best For |
|---|---|---|---|
| Deployment | A replica number you choose | Anywhere the scheduler likes | Websites, APIs and everyday stateless services |
| StatefulSet | A replica number you choose | Anywhere, with stable names and disks | Databases and clustered systems |
| DaemonSet | The number of matching nodes | One per eligible node | Node helpers: logs, metrics, networking, security |
| Job | Completion count | Anywhere | One-time tasks that finish |
| CronJob | Schedule | Anywhere | Recurring tasks |
| Static pod | A file on one node | That specific node | Core cluster parts started by the kubelet |
DaemonSet versus Deployment
A Deployment cares about how many copies exist. A DaemonSet cares about which nodes have a copy. If your question is “how many web servers do I need for my traffic?” you want a Deployment. If your question is “which programs must exist on every machine?” you want a DaemonSet.
DaemonSet versus static pods
Static pods are defined as files on a particular node and are run directly by that node’s manager program, the kubelet. They are tied to one machine and are not managed through the cluster’s normal controllers. A DaemonSet, in contrast, is a proper cluster object: you manage it centrally, update it with rolling updates and watch it through the API.
A Deployment is a staffing agency that promises five workers somewhere in the company. A DaemonSet is a rule that each office gets one receptionist. A static pod is a receptionist hired directly by one particular office, who never shows up in the head office’s records.
Ask: “If I add a new machine to the cluster tomorrow, should this program automatically appear on it?” If the answer is yes, it is probably a DaemonSet. If the answer is “no, I only need N copies anywhere,” use a Deployment.
4The Vocabulary You Need First
Eight simple terms make the rest of the story easy.
Node
One machine in the cluster, real or virtual, where pods run.
Pod template
The blueprint inside the DaemonSet that describes what each pod should look like: its containers, settings and volumes.
Label and selector
A label is a tag on an object. A selector is a rule that picks objects by their tags. A DaemonSet uses one to know which pods belong to it.
Node selector
A simple rule that limits a DaemonSet to nodes carrying certain labels, such as a graphics card label.
Taint
A mark on a node that repels pods, like a reserved sign on a table.
Toleration
A badge on a pod that lets it ignore a matching taint and land on the reserved node.
Controller
A watchful program inside Kubernetes that compares what you asked for with what exists and fixes any gap.
Rolling update
A way of changing versions gradually, node by node, so that not everything stops at the same time.
Taints and tolerations in plain words
Some nodes are deliberately kept for special work. For example, the nodes that run the cluster’s control plane, its brain, are normally marked so that ordinary application pods stay away. That mark is a taint. A pod that wants to run there must carry a matching toleration. DaemonSets often need such tolerations, because a monitoring agent that skips the control plane nodes leaves blind spots.
Imagine a staff-only floor in an office building. A taint is the sign on the lift saying “Staff Only.” A toleration is the staff badge that lets you go up. A DaemonSet for security guards would naturally carry that badge, because guards must visit every floor.
Kubernetes automatically adds several tolerations to DaemonSet pods, such as those for nodes that are not ready, unreachable or under memory or disk pressure, so that node helpers keep running even on troubled machines.
5How a DaemonSet Works Inside
The DaemonSet controller is a tireless comparer of two lists: the nodes that should have a pod and the nodes that do.
Kubernetes works on the idea of desired state and actual state. You describe what you want, and controllers keep comparing it with reality. The DaemonSet controller lives in the control plane, the cluster’s brain, and continuously performs this simple loop.
flowchart LR
A[Watch nodes and DaemonSets] --> B[List nodes that should run the pod]
B --> C[List nodes that already have the pod]
C --> D{Any difference?}
D -->|Node missing a pod| E[Create a pod for that node]
D -->|Pod on wrong node| F[Delete that pod]
D -->|No difference| G[Do nothing]
E --> A
F --> A
G --> A
What the loop checks
Which nodes are eligible?
The controller looks at every node and applies the DaemonSet’s rules, such as node selectors and affinity, to decide whether that node should host a pod.
Which nodes already have a pod?
It finds the pods that carry the DaemonSet’s labels and notes which node each one lives on.
Fill the gaps
For each eligible node with no pod, it creates one. For a node that holds more than one, it removes the extras.
Remove the misplaced
If a node stops matching the rules, for example someone removes a label, its pod is deleted.
Report the numbers
It writes the counts of desired, current, ready and available pods into the DaemonSet’s status, so you can see the result at a glance.
Think of a warden with a checklist of every classroom in a school. Each morning, and whenever something changes, the warden walks around: “Room 4 has no fire extinguisher, so I add one. Room 9 has two, so I remove one. Room 12 has been closed, so I collect its extinguisher.” Then the warden writes the totals on the noticeboard.
Because this is a loop and not a one-time action, the DaemonSet heals itself. If someone deletes a DaemonSet pod by accident, it comes back. If a node is added, it gets a pod. You do not run any special command for either event.
6How a DaemonSet Pod Finds Its Node
Every DaemonSet pod is created for one specific node. The interesting part is how it gets there.
In older Kubernetes versions, the DaemonSet controller placed pods on nodes directly, bypassing the scheduler, the matchmaker that normally chooses a home for each pod. In modern versions, the controller instead creates each pod with a rule that says “this pod must run on node X,” and lets the ordinary scheduler carry out the placement. This means DaemonSet pods enjoy the same features as any other pods, such as priorities and preemption.
sequenceDiagram
participant U as You
participant A as API Server
participant D as DaemonSet Controller
participant S as Scheduler
participant K as kubelet on Node 3
U->>A: Create DaemonSet
D->>A: Watch and see DaemonSet
D->>A: Create one pod per eligible node
Note over D,A: Each pod carries a rule pinning it to one node
S->>A: Bind each pod to its pinned node
K->>A: Any pods assigned to me?
A-->>K: Yes, start this pod
K->>A: Report pod running
Why pinning matters
Each DaemonSet pod carries an instruction, in the form of node affinity, that matches exactly one node’s name. That guarantees that the pod meant for Node 3 cannot end up on Node 5. The scheduler still checks that the node has enough room, but the choice of node is not open.
Assuming that a DaemonSet pod will always run. If a node lacks enough free memory or processing power for the pod’s requests, that node’s pod stays Pending. The DaemonSet status will then show that the desired count is higher than the ready count.
Imagine a courier company that prints a delivery label for every building on a route. Each label carries the building’s exact address, so a parcel cannot be delivered anywhere else. The dispatcher still checks whether the building has a working door, but never chooses a different destination.
7Common Use Cases: What Runs as a DaemonSet
If it must be on every machine, it is a DaemonSet candidate. Here are the classic jobs.
Log collection
Programs such as Fluent Bit or Fluentd run one pod per node, read the log files of every container on that node and forward them to a central store. Without a DaemonSet, some machines would have unwatched logs.
Node monitoring
Agents such as the Prometheus Node Exporter and commercial monitoring agents measure processor, memory, disk and network on each machine, so dashboards and alerts cover every node.
Cluster networking
Network plugins, such as Calico, Cilium or the cloud provider’s own plugin, run an agent on every node to wire pods into the network. The kube-proxy program that maintains Service rules is also commonly run as a DaemonSet.
Storage drivers
Storage plugins that connect disks to pods often need a helper on each node that can attach and mount volumes locally.
Security and compliance
Runtime security tools watch system calls and file changes on each node to detect suspicious behaviour, while vulnerability scanners inspect each machine.
Hardware helpers
Device plugins, such as those that expose graphics processors to pods, run on nodes that have such hardware, and the DaemonSet is restricted to those nodes using labels.
| Category | What the Pod Does on Each Node | Why One per Node |
|---|---|---|
| Logging | Reads local container logs and forwards them | Logs live on the node’s disk |
| Monitoring | Measures the node’s resources | Each machine has its own numbers |
| Networking | Programs routes and rules locally | Each node must connect its own pods |
| Storage | Attaches and mounts volumes | Mounting happens on the node itself |
| Security | Observes local activity | Threats appear on individual machines |
| Hardware | Advertises devices to the cluster | Devices are attached to specific nodes |
Even on managed cloud clusters such as Amazon EKS, Google GKE and Azure AKS, you will find DaemonSets already running in the system namespace, quietly providing networking, logging and monitoring for every node.
8Running on Only Some Nodes
“Every node” is the default, but you can narrow the group in several ways.
Node selector: the simple filter
A node selector says “only nodes carrying this label.” If you label your machines that have graphics cards, a DaemonSet with that selector will run only on them. Add the label to a new node and a pod appears. Remove the label and the pod is deleted.
Node affinity: the richer filter
Node affinity offers more expressive rules, such as “nodes whose zone is one of these three” or “prefer nodes with fast disks.” For DaemonSets, the hard “required” form is the one that matters, because a DaemonSet pod either belongs on a node or does not.
Tolerations: reaching reserved nodes
Nodes reserved for special purposes carry taints. To include them, add tolerations to the pod template. The most common case is the control plane nodes. A monitoring or logging agent that cannot run there leaves the cluster’s most important machines unobserved.
Only Linux nodes
Use a node selector on the operating system label, so Windows nodes are skipped by a Linux-only agent.
Only graphics nodes
Label nodes that have graphics hardware and select them, so the device helper runs only where it makes sense.
Include control plane nodes
Add a toleration for the control plane taint, so security and monitoring agents cover those machines too.
One zone only
Use affinity on the zone label for an agent that supports just one part of your infrastructure.
flowchart TB
DS[DaemonSet with node selector gpu equals true]
DS --> A[Node A labelled gpu: pod runs]
DS --> B[Node B labelled gpu: pod runs]
DS -. skipped .-> C[Node C no label: no pod]
DS -. skipped .-> D[Node D no label: no pod]
A hotel chain rule might say “every hotel gets a fire alarm” but “only beach hotels get a lifeguard.” Labels on each hotel tell head office which rules apply. Change a hotel’s label and its staffing changes automatically.
Forgetting tolerations and then wondering why the agent is missing on a set of nodes. If DESIRED is lower than the total number of nodes, a taint or a selector is usually excluding some of them.
9Updating a DaemonSet Safely
Changing a node helper on hundreds of machines at once is risky. Update strategies control the pace.
When you change the pod template, for example to use a newer version of an agent, Kubernetes must replace the pods on every node. It offers two update strategies, chosen in the DaemonSet’s description.
RollingUpdate: the default, automatic pace
The controller replaces old pods with new ones node by node. By default, at most one node’s pod is unavailable at a time. You can raise this number, or express it as a percentage, to go faster on big clusters. A new pod must become ready before the controller moves on.
OnDelete: manual pace
The controller does not touch existing pods when the template changes. New pods with the new version appear only when you delete the old ones yourself, or when nodes are recreated. This is useful when you want tight control, such as updating nodes in a specific order.
Surge: starting the new before stopping the old
Recent Kubernetes versions also support a maximum surge setting for DaemonSet rolling updates. With surge, the new pod is started on a node before the old one is stopped, so the node is never without its helper. This helps for programs such as network agents or ingress-style helpers where a gap would hurt. There is a caution: for a short time, two pods of the same DaemonSet coexist on one node, so they must not fight over shared resources such as a fixed port.
You change the template
A new image version, new setting or new resource request creates a new revision of the DaemonSet.
The controller picks the first nodes
Based on the allowed number of unavailable nodes, it deletes the old pods there.
New pods start and must become ready
The controller waits for readiness, and optionally for a minimum ready time, before treating the node as finished.
The wave moves across the cluster
The controller repeats the process until every eligible node runs the new version.
Rollback if needed
Kubernetes remembers earlier revisions, so you can roll back to a previous version if the new one misbehaves.
flowchart LR
V1[All nodes on version 1] --> R1[Update node 1]
R1 --> R2[Update node 2]
R2 --> R3[Update node 3]
R3 --> V2[All nodes on version 2]
R2 -. problem found .-> RB[Roll back to version 1]
Set a minimum ready time so that a pod that starts and crashes a minute later does not fool the controller into moving on. Test each new version of a critical agent on a small group of nodes first.
| Setting | What It Controls | Typical Advice |
|---|---|---|
| maxUnavailable | How many nodes may lack a working pod during the update | Keep low for critical helpers, raise on large clusters |
| maxSurge | How many extra pods may exist while updating | Use where a gap is unacceptable and ports do not clash |
| minReadySeconds | How long a new pod must stay healthy before it counts | Set to catch early crashes |
| OnDelete strategy | Waits for you to delete pods manually | For strict manual control |
10Talking to DaemonSet Pods
Because each pod serves its own node, the usual “send traffic to any copy” approach often does not fit.
A web application behind a Service can be reached at any of its pods, and the Service spreads traffic. A node helper is different: a pod collecting logs on Node 3 has meaning only for Node 3. So how do other programs reach it? Several patterns exist.
Push from the agent
The most common approach: the DaemonSet pod reaches outward, sending logs or metrics to a central server. Nobody needs to call into it.
Node IP and host port
Pods on the same node reach the local helper through the node’s address and a fixed port that the helper opens on the host.
Host network
The pod shares the node’s network directly, which is common for network and monitoring agents that must see the machine’s real interfaces.
Headless Service
A Service with no virtual address lets other programs discover every DaemonSet pod’s address, for example so a monitoring system can scrape each one.
Node-local Service traffic
A Service can be set to send traffic only to pods on the same node as the caller, keeping calls local and fast.
Shared files
Some helpers communicate through a folder on the node that application pods also mount, such as a socket file.
flowchart LR
subgraph N1[Node 1]
APP1[Application pod] -->|local call| AG1[Agent pod]
end
subgraph N2[Node 2]
APP2[Application pod] -->|local call| AG2[Agent pod]
end
AG1 -->|pushes data| CENTRAL[Central server]
AG2 -->|pushes data| CENTRAL
Consider the post box on each street. Residents drop letters into their own street’s box, and a van collects from every box and takes the letters to the central sorting office. Residents never travel to a distant box, and the sorting office never needs to visit each house.
Using a fixed host port for a DaemonSet pod and then trying to run two such pods on one node during an update surge. Only one process can hold a port on a machine, so the second pod fails to start.
11Reaching Into the Host: Power and Risk
Node helpers often need to see things that ordinary pods are kept away from. That power needs care.
Normal pods live in a sealed space with little view of the machine around them. But a log collector must read the log folder on the node, a monitoring agent must read the machine’s own statistics, and a security tool must see other programs’ activity. DaemonSet pods therefore often ask for special access.
hostPath volumes
Mount a folder from the node’s own file system into the pod, such as the folder where container logs are written.
Host network
Share the node’s network so that the pod sees the real network interfaces and can bind to the node’s ports.
Host PID
See every process running on the machine, useful for monitoring and security agents.
Privileged mode
Grant almost the same powers as an administrator on the host. Some low-level tools genuinely need it, but it is the riskiest option.
Think of a master key held by a building’s maintenance staff. It opens every door, which is exactly what they need, and exactly what makes losing it dangerous. DaemonSet pods with host access are the maintenance staff of your cluster.
Sensible habits
- Request only the specific host access the agent truly needs.
- Mount host folders as read-only whenever the agent only reads.
- Prefer narrow capabilities over full privileged mode.
- Keep such DaemonSets in a protected, restricted namespace.
Risky habits
- Running everything as privileged out of convenience.
- Mounting the entire host file system when one folder is enough.
- Using untrusted or unpinned images for host-level agents.
- Letting many people edit these DaemonSets without review.
A compromised DaemonSet pod with host access can affect every node it runs on. That means one weakness spreads across the whole cluster, so these pods deserve the strictest review of any workload.
12Resources, Priority and the Cost of Being Everywhere
One pod per node sounds small, but it is multiplied by every node in the cluster.
Suppose an agent asks for a small slice of processor and memory. On a cluster of five nodes, this is barely noticeable. On a cluster of five hundred nodes, the same small request becomes five hundred slices reserved across the fleet. And that reservation is taken from every node before your own applications get their share.
Requests and limits
Every container can declare a request, the amount it needs and that the scheduler reserves, and a limit, the maximum it may use. For DaemonSets, both should be chosen with care. Too small, and the agent is starved or killed for exceeding memory. Too large, and every node loses capacity you could have used for applications.
Think of a rule that every flat in a building must reserve one parking space for the caretaker’s scooter. One space is trivial, but across three hundred flats it is a large parking area that residents can never use. Small per-node costs add up to large fleet-wide costs.
Priority: helpers must survive pressure
When a node runs short of resources, Kubernetes may remove low-priority pods to protect itself. Node helpers that the machine depends on, such as networking agents, should not be the first to go. Kubernetes provides built-in high-priority classes for system-level components, and critical DaemonSets can use them so that they are protected and, if needed, can even push out less important pods.
| Concern | What Can Go Wrong | Sensible Response |
|---|---|---|
| Requests too high | Every node loses room for applications | Measure real usage and set modest requests |
| Memory limit too low | Agent is killed repeatedly | Leave headroom above typical use |
| No requests set | Scheduler cannot plan and the pod is first to be evicted | Always set requests |
| Low priority | Agent removed under pressure, leaving the node blind | Use an appropriate priority class for critical helpers |
| Autoscaling effects | Every new node starts with the daemon overhead already used | Include this overhead in capacity planning |
When sizing nodes, remember that DaemonSet pods take their share first. A cluster with many DaemonSets may need slightly larger machines simply to leave the same room for applications.
13Health, Restarts and Troubled Nodes
A helper that fails silently defeats its purpose. Kubernetes gives several safety nets.
Restart policy
DaemonSet pods must use the restart policy Always. If a container crashes, the kubelet restarts it in place, with growing delays between attempts if it keeps failing. This matches the purpose: a node helper should always be running.
Probes
Probes are small regular health checks. A liveness probe restarts the container if it seems stuck. A readiness probe tells Kubernetes whether the pod is ready, which also controls whether a rolling update may move to the next node. A startup probe gives slow programs time to start. Well-chosen probes make updates safer and failures easier to spot.
Surviving troubled nodes
Since node helpers exist to support troubled machines, Kubernetes automatically gives DaemonSet pods tolerations for common node problems, such as running low on memory or disk, or becoming unreachable. Regular application pods would be moved away in these situations, but DaemonSet pods are designed to stay.
stateDiagram-v2
[*] --> Pending
Pending --> Running: node has room
Running --> Restarting: container crashes
Restarting --> Running: restart succeeds
Running --> Removed: node deleted or no longer matches
Removed --> [*]
Think of a lifeguard at a beach. When the weather turns rough, ordinary visitors leave, but the lifeguard stays. DaemonSet pods are the lifeguards of the cluster, made to remain when conditions get difficult.
Giving a helper agent a liveness check that depends on an outside server, such as the central log store. If that server has a short outage, every agent on every node restarts at once, and the problem multiplies. Liveness should look only at the agent’s own health.
14Security Considerations
A pod that runs on every node, often with special powers, is a high-value target and a high-impact mistake.
Least privilege
Grant the pod only the host access and cluster permissions it needs. Avoid full privileged mode unless the tool truly requires it.
Restricted service account
Give the DaemonSet its own identity with narrow permissions, so a stolen token cannot do damage across the cluster.
Trusted, pinned images
Use images from trusted registries, scan them and pin exact versions or digests, since a bad image would run on every node at once.
Read-only mounts
Where the agent only reads host data, mount folders as read-only so it cannot alter the node’s files.
Change control
Restrict who may edit DaemonSets. A malicious change here spreads to every machine in minutes.
Network Policies
Limit what the agent may talk to, especially if it holds sensitive data such as logs or credentials.
Imagine a company memo that is automatically delivered to every desk in every branch. That reach is wonderful for good news, and dangerous for a mistake or a forgery. Anything sent this way deserves an extra check before sending.
Keep node-level DaemonSets in a dedicated namespace, apply pod security rules that allow only what those agents need, and review changes to them as carefully as changes to the cluster itself.
15Monitoring, Logging and Metrics
Ironically, the programs that watch everything also need watching.
Reading the DaemonSet’s own numbers
Every DaemonSet reports a handful of counts in its status. Learning to read them is the fastest way to spot trouble.
| Number | Meaning | What a Gap Suggests |
|---|---|---|
| Desired | How many nodes should run the pod | Lower than total nodes means selectors or taints exclude some |
| Current | How many nodes currently have a pod scheduled | Lower than desired means pods are missing or blocked |
| Ready | How many pods have passed readiness checks | Lower than current means pods are unhealthy or starting |
| Up to date | How many pods run the latest template | Lower than current means an update is in progress or stuck |
| Available | How many pods have been ready for the minimum time | Lower than ready means pods are too new or flapping |
| Misscheduled | Pods running where they should not | Above zero means rules changed or something is wrong |
The three pillars for DaemonSet pods
Metrics
Cluster-state tools such as kube-state-metrics publish the desired, ready and misscheduled counts, and monitoring systems such as Prometheus can alert when they drift apart.
Logs
Each pod’s logs show why the agent failed to start or crashed. Since DaemonSet pods are many, a central log system is essential.
Events
Kubernetes records short notes such as failed scheduling, image pull errors and killed containers, which quickly explain a missing pod.
Consider a chain of shops with a smoke detector in every branch. Head office also needs a dashboard showing which detectors are working. A silent broken detector is worse than none, because everyone assumes the branch is protected.
Create an alert for “ready pods lower than desired for more than a few minutes.” It catches most DaemonSet problems, from failed image pulls to full nodes, before users notice missing logs or metrics.
16Troubleshooting Thinking for Beginners
When a DaemonSet misbehaves, compare its numbers, then follow the chain from node to pod.
Compare desired with the number of nodes
If desired is lower than expected, a selector, affinity rule or taint is excluding nodes. Check node labels and pod tolerations.
Find the nodes without a working pod
List the pods and notice which nodes lack a Running pod. Those nodes are your suspects.
Read the pod’s events
Describing a stuck pod usually reveals the reason: not enough resources, an image that cannot be pulled, a missing volume or a blocked host port.
Read the container logs
If the pod starts but fails, the logs, including those of the previous run, show configuration or permission errors.
Check the rollout
If pods are on different versions, look at the update strategy, unavailable limits and readiness. A pod that never becomes ready can stall the entire update.
Consider the node itself
If only one node is affected, the machine may be full, unhealthy or missing something the agent needs, such as a kernel feature.
Pending pod on one node
Usually that node lacks free resources for the pod’s requests, or a rule prevents placement.
No pod on control plane nodes
The control plane taint is repelling the pod. Add the matching toleration if you want coverage there.
Rolling update stuck halfway
A new pod is not becoming ready, so the controller will not move on. Fix the pod or roll back.
Crash loop on every node
Usually a bad configuration, image or permission in the template, since every node uses the same blueprint.
If every node fails, suspect the template. If only some nodes fail, suspect the nodes: their resources, labels, taints or operating system.
17Advantages and Trade-offs
A DaemonSet is the right tool for one job, and the wrong tool for most others.
Advantages
- Guarantees coverage of every eligible node, with no manual counting.
- Automatically follows nodes joining and leaving the cluster.
- Self-healing: deleted or crashed pods are replaced.
- Supports controlled rolling updates and rollbacks.
- Can target subsets of nodes using labels, affinity and tolerations.
- Central management of node-level software from one place.
Disadvantages / Trade-offs
- Cannot be scaled by count; the number follows the nodes.
- Resource costs are multiplied by the number of nodes.
- Host access makes DaemonSet pods a security-sensitive target.
- A bad update can hit every node in a short time.
- Unsuitable for ordinary application workloads.
When a DaemonSet is a good fit
Choose one when the program is tied to the machine, not to your application’s load: logs, node metrics, networking, storage plumbing, security monitoring and hardware exposure. Also choose it when you want new nodes to be covered automatically.
When to choose something else
If you need a certain number of copies, use a Deployment. If you need stable identities and disks, use a StatefulSet. If the task finishes, use a Job. And if the helper could instead be added as a sidecar inside each application’s pod, consider whether per-pod coverage suits better than per-node coverage.
| Situation | Better Choice | Reason |
|---|---|---|
| Web application with changing traffic | Deployment with autoscaling | Count should follow load, not node number |
| Log shipper for every node | DaemonSet | Logs live on each node |
| Database with stable identity | StatefulSet | Needs fixed names and disks |
| One-off data migration | Job | It should end |
| Per-application helper such as a proxy | Sidecar in the pod | Belongs to the application, not the node |
18Design Patterns and Anti-Patterns
Habits that experienced teams follow, and traps they learned to avoid.
Helpful patterns
Agent per node, push to central
Each agent collects local data and pushes it out to a central system, so nothing needs to call into individual pods.
Dedicated system namespace
Keep node-level DaemonSets together in a protected namespace with tight access rules.
Small, staged rollouts
Label a few test nodes, run the new version there first, then widen the rollout to the fleet.
Priority classes for critical agents
Use system-level priorities for helpers the node cannot live without, so they survive resource pressure.
Traps to avoid
Problem
Using a DaemonSet for an ordinary application just to get one pod per node.
Why It’s Harmful
Scaling then follows node count, not traffic. You cannot add capacity without adding machines, and you waste resources on quiet nodes.
Correct Approach
Use a Deployment with autoscaling, and spread pods across nodes with anti-affinity or topology spread rules.
Problem
Giving every DaemonSet privileged mode and full host access by default.
Why It’s Harmful
One vulnerable or malicious agent then controls every node, and the damage spreads across the whole fleet.
Correct Approach
Grant the narrowest access required, use read-only mounts and specific capabilities, and review each host permission.
Problem
Leaving out resource requests, limits and priority for node agents.
Why It’s Harmful
Agents may hog memory and starve applications, or be the first to be evicted, leaving nodes unmonitored just when trouble starts.
Correct Approach
Measure real usage, set modest requests and sensible limits, and use an appropriate priority class.
Problem
Updating every node’s agent at once, or using an unpinned latest image tag.
Why It’s Harmful
A single faulty version breaks logging, networking or monitoring across the whole cluster together, and nobody can tell which version is where.
Correct Approach
Pin exact versions, keep unavailable limits low, set a minimum ready time and roll out gradually with a tested rollback path.
19Best Practices Checklist for Beginners
Simple habits that prevent most early pain.
Use DaemonSets only for node-level jobs
If the program serves your application’s users, it probably belongs in a Deployment instead.
Set modest, measured resources
Remember the cost is multiplied by every node. Measure, then set requests and limits.
Plan tolerations and selectors deliberately
Decide which nodes need coverage, including control plane and special hardware nodes, and encode that in the template.
Add probes and a minimum ready time
Good health checks make rolling updates safe and failures visible.
Lock down host access
Use the least privilege possible, read-only mounts and trusted, pinned images.
Alert on desired versus ready
Watch the DaemonSet’s own numbers, so a node without its helper never goes unnoticed.
On a practice cluster with two or three nodes, create a simple DaemonSet, then add a node or label one to see the pod appear, and remove the label to see it vanish. Watching the loop react teaches the idea faster than any explanation.
20DaemonSets in the Real World
You may have used a cluster for months without noticing that DaemonSets were quietly working.
A retail company covering a festival sale
Traffic surges and the cluster autoscaler adds many new nodes within minutes. Each new node automatically receives its networking agent, log collector and monitoring agent from DaemonSets, so new capacity is observable and connected from the first second.
A bank meeting audit requirements
Security teams deploy a runtime security tool as a DaemonSet with tolerations for every node type. Auditors can see from the DaemonSet’s status that every machine, including control plane nodes, is covered.
A machine learning platform with graphics nodes
Only nodes with graphics hardware carry a special label. A device plugin DaemonSet selects those nodes and advertises the hardware to the cluster, so training jobs can request it.
A media company centralising logs
A log shipper DaemonSet reads container logs from each node and forwards them to a central search system. Teams debug from one dashboard without ever logging in to a machine.
A managed cloud cluster
On services such as EKS, GKE and AKS, system DaemonSets provide pod networking, service routing and node-level telemetry. Users usually only manage the additional DaemonSets they add themselves.
| Typical DaemonSet | Purpose | Runs On |
|---|---|---|
| Network plugin agent | Wires pods into the cluster network | Every node |
| kube-proxy | Maintains Service routing rules | Every node, in many clusters |
| Log collector | Ships container logs to a central store | Every node |
| Node metrics exporter | Publishes machine statistics | Every node |
| Storage node plugin | Mounts volumes locally | Nodes that use that storage |
| Graphics device plugin | Exposes graphics hardware | Nodes with graphics cards |
21Frequently Asked Questions
No. There is no replica setting. The number of pods equals the number of eligible nodes. To change it, change which nodes are eligible using labels, affinity or tolerations.
Not by default, because those nodes normally carry a taint that repels ordinary pods. Add a matching toleration to the pod template if you want the pod there.
If the node matches the DaemonSet’s rules, the controller creates a pod for it automatically within moments of the node registering. No manual action is needed.
The pod on that node is cleaned up. It is not moved to another node, because every other eligible node already has its own pod.
Normally no. The design is one pod per eligible node. The exception is a brief overlap during a rolling update that uses surge, where the new pod starts before the old one stops.
Change the pod template, for example the image version. With the default rolling update strategy, Kubernetes replaces pods node by node. With the OnDelete strategy, pods update only when you delete them.
Yes. Kubernetes stores revisions of the DaemonSet, so you can return to an earlier version using the rollout undo feature of the command-line tool.
By default all its pods are deleted too. If you delete with the orphan option, the pods are left running without an owner, which is sometimes useful when replacing one DaemonSet with another.
Most often that node has too little free processing power or memory for the pod’s requests, or a fixed host port is already taken. Describing the pod shows the reason in its events.
No. A sidecar is a helper container inside each application pod, one per pod. A DaemonSet pod is one per node and serves all pods on that node. Choose based on whether the helper belongs to an application or to a machine.
Often yes. Kubernetes automatically adds tolerations for common node conditions, such as not ready or resource pressure, so that node helpers stay in place even when ordinary pods would be moved away.
22Summary and Key Takeaways
A DaemonSet is a Kubernetes object that keeps exactly one pod running on every eligible node, or on a chosen group of nodes. It exists because some programs, such as log collectors, monitoring agents, network plugins, storage helpers and security tools, belong to the machine, not to your application’s load. A DaemonSet controller constantly compares the list of nodes with the list of pods, creating pods for new nodes and cleaning up after departed ones.
Around this simple idea sits a rich set of controls: node selectors, affinity and tolerations to choose where pods run, rolling updates and rollbacks to change versions safely, probes and priorities to keep helpers healthy, and careful security settings because these pods often reach deep into the host. The costs are multiplied by node count, and so are the risks, which makes measured resources and strict permissions especially important.
Keep the hotel chain picture in mind. Head office does not chase each branch about its fire alarm. It sets one rule: every branch, always, exactly one. New branches get one automatically, and a watchful manager keeps checking that the rule holds. That is the DaemonSet.
Key Takeaways
- One pod per node — a DaemonSet ensures a copy of a pod runs on every eligible node, with no replica count to manage.
- It follows the cluster — nodes joining get a pod automatically, and pods on departed nodes are cleaned up.
- Built for node helpers — logging, monitoring, networking, storage, security and hardware agents are the classic uses.
- You choose where it runs — node selectors, affinity and tolerations narrow or widen the group, including control plane nodes.
- Updates are gradual and reversible — rolling updates, unavailable and surge limits, ready times and rollbacks reduce risk.
- Costs and risks are multiplied — resources are reserved on every node, and host access makes these pods security-sensitive.
- Watch the numbers — desired, ready and misscheduled counts reveal most problems, and alerting on them protects node coverage.