Course contentsShow
← Cloud and Infrastructure
Lesson 1185 of 2,98923. Kubernetes WorkloadsFree lesson

DaemonSet Fundamentals

Using DaemonSets to run a copy of a pod on every node in the cluster.

DaemonSet Fundamentals

What you'll learn: How to use DaemonSets to automatically run one copy of a pod on every node in your Kubernetes cluster.

What Is a DaemonSet?

A DaemonSet ensures that all (or some) nodes in your cluster run an exact copy of a specific pod. Think of it like installing a system-wide utility on every computer in an office—each machine gets its own copy automatically.

Unlike Deployments or ReplicaSets where you specify how many replicas you want, a DaemonSet says "I want this pod on every node"—the count is determined by the number of nodes.

When to Use DaemonSets

DaemonSets are perfect for node-level tasks that need to run everywhere:

  • Log collectors: Gathering logs from every node (like Fluentd or Logstash agents)
  • Monitoring agents: Collecting metrics from each node (like Prometheus Node Exporter)
  • Network plugins: Managing networking on every node (like Calico or Weave)
  • Storage daemons: Providing storage capabilities per node

How DaemonSets Work

When you create a DaemonSet:

  1. The controller watches for existing and new nodes
  2. It automatically schedules a pod on each qualifying node
  3. If a node is added, the pod is deployed there automatically
  4. If a node is removed, the pod is cleaned up
  5. If you delete the DaemonSet, all its pods are removed

The beauty is the automatic distribution—no manual intervention needed as your cluster grows or shrinks.

Key Takeaway: DaemonSets ensure exactly one copy of a pod runs on every node in your cluster, making them ideal for cluster-wide services like monitoring, logging, and networking that must exist on each node.