CodeBlanks Logo Icon CodeBlanks

DaemonSet use cases

Learn DaemonSet use cases.

DaemonSet use cases

A DaemonSet's typical jobs are infrastructure tasks requiring an agent on every node:

  • Log collection: Fluent Bit, Fluentd, Promtail send the container logs on the node to a central place.
  • Monitoring: node-exporter and the Datadog agent collect node metrics.
  • Networking: kube-proxy, Calico, Cilium manage the node's network rules.
  • Storage: CSI node plugins attach disks to the node.
  • Security: tools like Falco watch kernel events.
kubectl get ds -n kube-system
NAME         DESIRED   CURRENT   READY
kube-proxy   3         3         3
calico-node  3         3         3

Resource limits matter

Since a DaemonSet pod runs on every node, its resource consumption is multiplied by the node count; an agent using 200 MiB of memory on 100 nodes means 20 GiB in total. Also, a priority class is given so critical agents aren't evicted:

      priorityClassName: system-node-critical
      containers:
        - name: fluent-bit
          image: fluent/fluent-bit:3.1
          resources:
            requests: {cpu: 50m, memory: 64Mi}
            limits:   {memory: 128Mi}

Practice A log collector

Write a DaemonSet template's spec section (starting with spec:): priorityClassName: system-node-critical; container named fluent-bit, image fluent/fluent-bit:3.1; resources.requests cpu: 50m, memory: 64Mi; resources.limits memory: 128Mi.

Starter code

terminal
# buraya yaz

Sample solution

terminal
spec:
  priorityClassName: system-node-critical
  containers:
    - name: fluent-bit
      image: fluent/fluent-bit:3.1
      resources:
        requests:
          cpu: 50m
          memory: 64Mi
        limits:
          memory: 128Mi

Expected output

daemonset.apps/fluent-bit created

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which is not suitable for a DaemonSet?

  • A web API serving user requests Correct answer
  • A log collector
  • A node metrics agent
  • A network plugin

Explanation: A web API's replica count depends on load, not the node count.

2 Give the critical agent priority.

Question
      ____: system-node-critical
Answer
      priorityClassName: system-node-critical

Explanation: priorityClassName sets eviction and scheduling priority.

3 Match the tools.

Term Meaning
Fluent Bit Log collection
node-exporter Metrics
Calico Networking
Falco Security

All lessons in Advanced