Files
my-docs/Containerization & Orchestration/Kubernetes/components/6-DaemonSet.md
2025-06-29 16:56:28 +03:30

926 B
Raw Blame History

🧩 DaemonSet in Kubernetes

A DaemonSet ensures that a copy of a specific pod runs on every (or some) node in the cluster. Its typically used for background system-level services like log collection, monitoring, or networking tools.


📌 Key Characteristics

  • Automatically deploys one pod per worker node.
  • Ensures the pod stays on each node as long as the DaemonSet exists.
  • Automatically adds pods to new nodes when they join the cluster.

📄 Example DaemonSet YAML

Below is a simple DaemonSet example that deploys nginx to every node in the web namespace:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: nginx
  namespace: web
  labels:
    app: web-servers
spec:
  selector:
    matchLabels:
      app: web-servers
  template:
    metadata:
      labels:
        app: web-servers
    spec:
      containers:
        - name: nginx
          image: nginx:1.27