DaemonSet in Kubernetes

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.

Need 1

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.

Need 2

Measure health

Processor, memory, disk and network use must be measured on every machine, not just on a few of them.

Need 3

Connect the network

Each node needs a network helper so that its pods can talk to pods on other nodes.

Need 4

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.

Simple Analogy

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.

!
Common Misconception

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.

1 per node
the DaemonSet promise
Automatic
follows nodes joining and leaving
No count
you never set a replica number

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.

Simple Analogy

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

1

A node exists, so a pod appears

When you create a DaemonSet, Kubernetes puts one pod on every eligible node in the cluster.

2

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.

3

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.

4

The DaemonSet is deleted, so all its pods go

Removing the DaemonSet removes every pod it created, unless you deliberately ask to keep them.

“With a DaemonSet you never say how many. You say where, and Kubernetes counts for you.”
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
        
FIG 1 — One DaemonSet keeping exactly one pod on every node

3DaemonSet Compared With Its Neighbours

Kubernetes offers several managers for pods. Choosing the right one is half the skill.

ManagerControls Count ByPlacementBest For
DeploymentA replica number you chooseAnywhere the scheduler likesWebsites, APIs and everyday stateless services
StatefulSetA replica number you chooseAnywhere, with stable names and disksDatabases and clustered systems
DaemonSetThe number of matching nodesOne per eligible nodeNode helpers: logs, metrics, networking, security
JobCompletion countAnywhereOne-time tasks that finish
CronJobScheduleAnywhereRecurring tasks
Static podA file on one nodeThat specific nodeCore 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.

Simple Analogy

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.

i
Decision Shortcut

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.

Term 1

Node

One machine in the cluster, real or virtual, where pods run.

Term 2

Pod template

The blueprint inside the DaemonSet that describes what each pod should look like: its containers, settings and volumes.

Term 3

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.

Term 4

Node selector

A simple rule that limits a DaemonSet to nodes carrying certain labels, such as a graphics card label.

Term 5

Taint

A mark on a node that repels pods, like a reserved sign on a table.

Term 6

Toleration

A badge on a pod that lets it ignore a matching taint and land on the reserved node.

Term 7

Controller

A watchful program inside Kubernetes that compares what you asked for with what exists and fixes any gap.

Term 8

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.

Simple Analogy

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.

i
Good to Know

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
        
FIG 2 — The endless reconciliation loop of the DaemonSet controller

What the loop checks

1

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.

2

Which nodes already have a pod?

It finds the pods that carry the DaemonSet’s labels and notes which node each one lives on.

3

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.

4

Remove the misplaced

If a node stops matching the rules, for example someone removes a label, its pod is deleted.

5

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.

Simple Analogy

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.

i
Key Insight

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
        
FIG 3 — From DaemonSet creation to pods running on every node

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.

!
Common Mistake

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.

Simple Analogy

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.

CategoryWhat the Pod Does on Each NodeWhy One per Node
LoggingReads local container logs and forwards themLogs live on the node’s disk
MonitoringMeasures the node’s resourcesEach machine has its own numbers
NetworkingPrograms routes and rules locallyEach node must connect its own pods
StorageAttaches and mounts volumesMounting happens on the node itself
SecurityObserves local activityThreats appear on individual machines
HardwareAdvertises devices to the clusterDevices are attached to specific nodes
i
Good to Know

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.

Scenario

Only Linux nodes

Use a node selector on the operating system label, so Windows nodes are skipped by a Linux-only agent.

Scenario

Only graphics nodes

Label nodes that have graphics hardware and select them, so the device helper runs only where it makes sense.

Scenario

Include control plane nodes

Add a toleration for the control plane taint, so security and monitoring agents cover those machines too.

Scenario

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]
        
FIG 4 — A DaemonSet limited to nodes that carry a particular label
Simple Analogy

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.

!
Common Mistake

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.

1

You change the template

A new image version, new setting or new resource request creates a new revision of the DaemonSet.

2

The controller picks the first nodes

Based on the allowed number of unavailable nodes, it deletes the old pods there.

3

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.

4

The wave moves across the cluster

The controller repeats the process until every eligible node runs the new version.

5

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]
        
FIG 5 — A rolling update moving across nodes, with a rollback escape route
i
Good Practice

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.

SettingWhat It ControlsTypical Advice
maxUnavailableHow many nodes may lack a working pod during the updateKeep low for critical helpers, raise on large clusters
maxSurgeHow many extra pods may exist while updatingUse where a gap is unacceptable and ports do not clash
minReadySecondsHow long a new pod must stay healthy before it countsSet to catch early crashes
OnDelete strategyWaits for you to delete pods manuallyFor 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.

Pattern 1

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.

Pattern 2

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.

Pattern 3

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.

Pattern 4

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.

Pattern 5

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.

Pattern 6

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
        
FIG 6 — Application pods talking to their local agent, agents pushing to a central server
Simple Analogy

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.

!
Common Mistake

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.

Access 1

hostPath volumes

Mount a folder from the node’s own file system into the pod, such as the folder where container logs are written.

Access 2

Host network

Share the node’s network so that the pod sees the real network interfaces and can bind to the node’s ports.

Access 3

Host PID

See every process running on the machine, useful for monitoring and security agents.

Access 4

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.

Simple Analogy

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.
i
Key Insight

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.

Simple Analogy

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.

ConcernWhat Can Go WrongSensible Response
Requests too highEvery node loses room for applicationsMeasure real usage and set modest requests
Memory limit too lowAgent is killed repeatedlyLeave headroom above typical use
No requests setScheduler cannot plan and the pod is first to be evictedAlways set requests
Low priorityAgent removed under pressure, leaving the node blindUse an appropriate priority class for critical helpers
Autoscaling effectsEvery new node starts with the daemon overhead already usedInclude this overhead in capacity planning
i
Good Practice

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 --> [*]
        
FIG 7 — The life of one DaemonSet pod on one node
Simple Analogy

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.

!
Common Mistake

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.

Layer 1

Least privilege

Grant the pod only the host access and cluster permissions it needs. Avoid full privileged mode unless the tool truly requires it.

Layer 2

Restricted service account

Give the DaemonSet its own identity with narrow permissions, so a stolen token cannot do damage across the cluster.

Layer 3

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.

Layer 4

Read-only mounts

Where the agent only reads host data, mount folders as read-only so it cannot alter the node’s files.

Layer 5

Change control

Restrict who may edit DaemonSets. A malicious change here spreads to every machine in minutes.

Layer 6

Network Policies

Limit what the agent may talk to, especially if it holds sensitive data such as logs or credentials.

“A DaemonSet multiplies everything: its usefulness, its cost and its risk.”
Simple Analogy

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.

i
Good Practice

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.

NumberMeaningWhat a Gap Suggests
DesiredHow many nodes should run the podLower than total nodes means selectors or taints exclude some
CurrentHow many nodes currently have a pod scheduledLower than desired means pods are missing or blocked
ReadyHow many pods have passed readiness checksLower than current means pods are unhealthy or starting
Up to dateHow many pods run the latest templateLower than current means an update is in progress or stuck
AvailableHow many pods have been ready for the minimum timeLower than ready means pods are too new or flapping
MisscheduledPods running where they should notAbove zero means rules changed or something is wrong
Desired = Ready
a healthy DaemonSet
Ready below Desired
some nodes lack a working helper
Misscheduled above 0
rules and reality disagree

The three pillars for DaemonSet pods

Pillar 1

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.

Pillar 2

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.

Pillar 3

Events

Kubernetes records short notes such as failed scheduling, image pull errors and killed containers, which quickly explain a missing pod.

Simple Analogy

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.

i
Good Practice

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.

1

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.

2

Find the nodes without a working pod

List the pods and notice which nodes lack a Running pod. Those nodes are your suspects.

3

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.

4

Read the container logs

If the pod starts but fails, the logs, including those of the previous run, show configuration or permission errors.

5

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.

6

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.

Symptom

Pending pod on one node

Usually that node lacks free resources for the pod’s requests, or a rule prevents placement.

Symptom

No pod on control plane nodes

The control plane taint is repelling the pod. Add the matching toleration if you want coverage there.

Symptom

Rolling update stuck halfway

A new pod is not becoming ready, so the controller will not move on. Fix the pod or roll back.

Symptom

Crash loop on every node

Usually a bad configuration, image or permission in the template, since every node uses the same blueprint.

i
Rule of Thumb

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.

SituationBetter ChoiceReason
Web application with changing trafficDeployment with autoscalingCount should follow load, not node number
Log shipper for every nodeDaemonSetLogs live on each node
Database with stable identityStatefulSetNeeds fixed names and disks
One-off data migrationJobIt should end
Per-application helper such as a proxySidecar in the podBelongs to the application, not the node

18Design Patterns and Anti-Patterns

Habits that experienced teams follow, and traps they learned to avoid.

Helpful patterns

Pattern 1

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.

Pattern 2

Dedicated system namespace

Keep node-level DaemonSets together in a protected namespace with tight access rules.

Pattern 3

Small, staged rollouts

Label a few test nodes, run the new version there first, then widen the rollout to the fleet.

Pattern 4

Priority classes for critical agents

Use system-level priorities for helpers the node cannot live without, so they survive resource pressure.

Traps to avoid

ANTI-PATTERN-01 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.

ANTI-PATTERN-02 Avoid
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.

ANTI-PATTERN-03 Avoid
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.

ANTI-PATTERN-04 Avoid
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.

1

Use DaemonSets only for node-level jobs

If the program serves your application’s users, it probably belongs in a Deployment instead.

2

Set modest, measured resources

Remember the cost is multiplied by every node. Measure, then set requests and limits.

3

Plan tolerations and selectors deliberately

Decide which nodes need coverage, including control plane and special hardware nodes, and encode that in the template.

4

Add probes and a minimum ready time

Good health checks make rolling updates safe and failures visible.

5

Lock down host access

Use the least privilege possible, read-only mounts and trusted, pinned images.

6

Alert on desired versus ready

Watch the DaemonSet’s own numbers, so a node without its helper never goes unnoticed.

i
Learning Tip

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 DaemonSetPurposeRuns On
Network plugin agentWires pods into the cluster networkEvery node
kube-proxyMaintains Service routing rulesEvery node, in many clusters
Log collectorShips container logs to a central storeEvery node
Node metrics exporterPublishes machine statisticsEvery node
Storage node pluginMounts volumes locallyNodes that use that storage
Graphics device pluginExposes graphics hardwareNodes with graphics cards

21Frequently Asked Questions

Q1Can I set the number of replicas in a DaemonSet?

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.

Q2Will a DaemonSet run on the control plane nodes?

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.

Q3What happens when I add a new node?

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.

Q4What happens when a node is removed?

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.

Q5Can I run two pods of the same DaemonSet on one node?

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.

Q6How do I update the software in a DaemonSet?

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.

Q7Can I roll back a bad DaemonSet update?

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.

Q8What happens to the pods if I delete the DaemonSet?

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.

Q9Why is my DaemonSet pod stuck in Pending on one node?

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.

Q10Is a DaemonSet the same as a sidecar?

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.

Q11Do DaemonSet pods survive node problems that evict normal pods?

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.