What is a DaemonSet in OpenShift?
A DaemonSet is a Kubernetes workload that ensures exactly one copy of a Pod runs on every selected node in the cluster.
Unlike a Deployment, where you specify the number of replicas, a DaemonSet automatically creates and removes Pods as nodes are added or removed.
Think of a DaemonSet as “one Pod per node.”
Why DaemonSets are Important in OpenShift
Many OpenShift platform services must run on every node because they collect metrics, logs, or provide node-level networking.
For example:
OpenShift Cluster
┌──────────────┬──────────────┬──────────────┐
│ │ │
▼ ▼ ▼
Worker-1 Worker-2 Worker-3
│ │ │
▼ ▼ ▼
Node Exporter Node Exporter Node Exporter
Each node has its own Node Exporter Pod.
If a new node joins:
Worker-4↓DaemonSet automatically creates↓Node Exporter Pod
No manual action is required.
DaemonSet vs Deployment
| Deployment | DaemonSet |
|---|---|
| Fixed number of replicas | One Pod per node |
| Used for applications | Used for node services |
| Scheduler decides placement | Automatically targets selected nodes |
| Scale manually | Scales with the number of nodes |
| Example: Web app | Example: Logging agent |
Example:
Deployment
Cluster10 Nodes↓Deployment replicas = 3↓Only 3 Pods
DaemonSet
Cluster10 Nodes↓DaemonSet↓10 Pods(1 on each node)
How DaemonSet Works
New Node Added │ ▼DaemonSet Controller detects node │ ▼Creates Pod │ ▼Pod scheduled on new node
If a node is removed:
Node Deleted↓DaemonSet Pod Deleted
Real OpenShift DaemonSets
Run:
oc get daemonset -A
Typical output:
NAMESPACE NAMEopenshift-monitoring node-exporteropenshift-logging collectoropenshift-ovn-kubernetes ovnkube-nodeopenshift-multus multusopenshift-machine-config machine-config-daemon
These are all critical platform components.
1. Node Exporter
Every Node↓Node Exporter↓CPUMemoryDiskFilesystemNetwork
Used by Prometheus for infrastructure monitoring.
2. Machine Config Daemon
MachineConfig↓Machine Config Operator↓Machine Config Daemon↓Every Node
The Machine Config Daemon applies operating system changes on each RHCOS node.
3. OVN-Kubernetes
Every node participates in cluster networking.
Node↓OVN Pod↓Programs Open vSwitch↓Pod Networking
Without it, Pods cannot communicate.
4. Vector Collector
OpenShift Logging deploys Vector as a DaemonSet.
Every Node↓Vector↓Collect container logs↓LokiSplunkElasticsearch
Each node collects its own logs locally and forwards them.
DaemonSet Architecture
DaemonSet Controller
│
┌─────────────────┼─────────────────┐
│ │ │
▼ ▼ ▼
Worker-1 Worker-2 Worker-3
│ │ │
▼ ▼ ▼
One Pod One Pod One Pod
Scheduling
The DaemonSet controller watches nodes.
Whenever a new node appears:
Node Ready↓Matches selector↓Create Pod↓Schedule Pod
Node Selectors
DaemonSets can target only specific nodes.
Example:
spec: template: spec: nodeSelector: node-role.kubernetes.io/worker: ""
Only worker nodes receive the Pod.
Taints and Tolerations
Control-plane nodes are often tainted.
Example:
master-0↓NoSchedule
To run there, the DaemonSet must tolerate the taint.
Example:
tolerations:- operator: Exists
Without the toleration:
Master Node×No Pod
Example DaemonSet
apiVersion: apps/v1kind: DaemonSetmetadata: name: node-exporterspec: selector: matchLabels: app: node-exporter template: metadata: labels: app: node-exporter spec: containers: - name: node-exporter image: prom/node-exporter
You don’t specify replicas.
The controller calculates the number automatically.
DaemonSet Lifecycle
Cluster3 Nodes↓DaemonSet↓3 Pods
Add two nodes:
Cluster5 Nodes↓DaemonSet↓5 Pods
Remove one node:
Cluster4 Nodes↓DaemonSet↓4 Pods
Common Use Cases
Monitoring
Node Exporter↓Metrics
Logging
Vector↓Collect logs
Networking
OVN↓Configure networking
Storage
CSI Node Plugin
Every Node↓Attach Volumes
Security
Examples:
- Falco
- Security agents
- Endpoint protection
- File integrity monitoring
DaemonSet vs StatefulSet
| DaemonSet | StatefulSet |
|---|---|
| One Pod per node | Stable Pod identity |
| Node services | Databases |
| Auto-scales with nodes | Fixed replica count |
| No persistent identity | Persistent identity |
DaemonSet vs Deployment
| Feature | Deployment | DaemonSet |
|---|---|---|
| Replica count | Yes | No |
| One Pod per node | No | Yes |
| Auto-scales with nodes | No | Yes |
| Typical use | Applications | Platform services |
Useful Commands
List DaemonSets:
oc get daemonset -A
Describe:
oc describe daemonset node-exporter -n openshift-monitoring
Check Pods:
oc get pods -o wide -n openshift-monitoring
Watch rollout:
oc rollout status daemonset/node-exporter -n openshift-monitoring
Edit:
oc edit daemonset node-exporter -n openshift-monitoring
Note: Do not edit OpenShift-managed DaemonSets (such as
node-exporter,machine-config-daemon, orovnkube-node) directly. They are managed by Operators, and your changes will typically be overwritten. Use the supported Operator configuration instead.
Troubleshooting DaemonSets
Missing Pod on a Node
Check:
oc get daemonset -A
Then:
oc describe daemonset <name>
Verify:
- Node Selector
- Taints
- Tolerations
- Resource availability
- Events
Pod Pending
Check:
oc describe pod <pod>
Common causes:
- No CPU
- No memory
- Taint not tolerated
- Missing image
- Failed image pull
New Node Has No Pod
Verify:
oc get nodes
Then:
oc get daemonset
Look for:
Desired Number ScheduledCurrent Number Scheduled
If they differ:
Desired = 10Current = 9
Investigate why one node isn’t running the DaemonSet Pod.
Real Production Example
A new worker node joins the cluster.
Within seconds:
New Worker↓OVN Pod↓Machine Config Daemon↓Node Exporter↓Vector↓CSI Driver
The node becomes fully integrated into the cluster without manual intervention.
Interview Answer (2 Minutes)
A DaemonSet is a Kubernetes workload that ensures one Pod runs on every selected node in the cluster. Unlike a Deployment, where you specify a replica count, a DaemonSet automatically creates a Pod on each matching node and removes it when the node leaves the cluster. In OpenShift, DaemonSets are used for node-level services such as the Machine Config Daemon, OVN-Kubernetes, Node Exporter, Vector log collectors, and CSI storage plugins because these components must run on every node. As the cluster scales, the DaemonSet scales automatically with it. When troubleshooting, I check the DaemonSet status, node selectors, taints and tolerations, events, and whether the number of scheduled Pods matches the number of eligible nodes. One important operational point is that OpenShift-managed DaemonSets are controlled by Operators, so they should be configured through the Operator rather than edited directly.