πŸ“šBook Signing at KubeCon EU 2026Meet us at Booking.com HQ (Mon 18:30-21:00) & vCluster booth #521 (Tue 24 Mar, 12:30-1:30pm) β€” free book giveaway!RSVP Booking.com Event
Deployments beginner ⏱ 15 minutes K8s 1.28+

Kubernetes DaemonSet: Run Pods on Every Node

Deploy DaemonSets in Kubernetes to run exactly one pod per node. Covers logging agents, monitoring, CNI plugins, node-level operations, and rolling updates.

By Luca Berton β€’ β€’ πŸ“– 5 min read

πŸ’‘ Quick Answer: Deploy DaemonSets in Kubernetes to run exactly one pod per node. Covers logging agents, monitoring, CNI plugins, node-level operations, and rolling updates.

The Problem

This is one of the most searched Kubernetes topics. Having a comprehensive, well-structured guide helps both beginners and experienced users quickly find what they need.

The Solution

Create a DaemonSet

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: fluentd
  namespace: logging
spec:
  selector:
    matchLabels:
      app: fluentd
  template:
    metadata:
      labels:
        app: fluentd
    spec:
      tolerations:
        - key: node-role.kubernetes.io/control-plane
          operator: Exists
          effect: NoSchedule    # Run on control plane too
      containers:
        - name: fluentd
          image: fluent/fluentd:v1.16
          resources:
            requests:
              cpu: 100m
              memory: 200Mi
            limits:
              memory: 500Mi
          volumeMounts:
            - name: varlog
              mountPath: /var/log
              readOnly: true
            - name: containers
              mountPath: /var/lib/docker/containers
              readOnly: true
      volumes:
        - name: varlog
          hostPath:
            path: /var/log
        - name: containers
          hostPath:
            path: /var/lib/docker/containers
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1       # Update one node at a time

Run on Specific Nodes Only

spec:
  template:
    spec:
      nodeSelector:
        node-type: gpu        # Only GPU nodes
      # Or use affinity
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: kubernetes.io/os
                    operator: In
                    values: ["linux"]

Common DaemonSet Use Cases

Use CaseImagePurpose
Log collectionfluent/fluentdShip node logs to central store
Monitoringprom/node-exporterExport node metrics
CNI plugincalico-nodeNetwork per node
Storagecsi-node-driverCSI plugin per node
SecurityfalcoRuntime threat detection
# Check DaemonSet status
kubectl get ds -A
kubectl rollout status ds/fluentd -n logging

# Restart DaemonSet
kubectl rollout restart ds/fluentd -n logging
graph TD
    A[DaemonSet Controller] --> B[Node 1: fluentd pod]
    A --> C[Node 2: fluentd pod]
    A --> D[Node 3: fluentd pod]
    A --> E[New Node: auto-creates pod]
    F[Node removed] --> G[Pod auto-deleted]

Frequently Asked Questions

What is the difference between DaemonSet and Deployment?

A Deployment runs N replicas scheduled wherever Kubernetes decides. A DaemonSet runs exactly one pod on every (or selected) node. Use DaemonSets for node-level agents (logging, monitoring, CNI).

Can I run a DaemonSet on specific nodes only?

Yes, use nodeSelector, node affinity, or tolerations to target specific nodes.

Best Practices

  • Start simple β€” use the basic form first, add complexity as needed
  • Be consistent β€” follow naming conventions across your cluster
  • Document your choices β€” add annotations explaining why, not just what
  • Monitor and iterate β€” review configurations regularly

Key Takeaways

  • This is fundamental Kubernetes knowledge every engineer needs
  • Start with the simplest approach that solves your problem
  • Use kubectl explain and kubectl describe when unsure
  • Practice in a test cluster before applying to production
#daemonset #per-node #logging #monitoring #kubernetes
Luca Berton
Written by Luca Berton

Principal Solutions Architect specializing in Kubernetes, AI/GPU infrastructure, and cloud-native platforms. Author of Kubernetes Recipes and creator of CopyPasteLearn courses.

Kubernetes Recipes book cover

Want More Kubernetes Recipes?

This recipe is from Kubernetes Recipes, our 750-page practical guide with hundreds of production-ready patterns.

Luca Berton Ansible Pilot Ansible by Example Open Empower K8s Recipes Terraform Pilot CopyPasteLearn ProteinLens