Summary - DaemonSet
- Docker & Kubernetes course
- Advanced
- Lesson 24/70
- 5 min
Combine YAML and nodeSelector to write a DaemonSet.
Summary: DaemonSet
In this group:
- A DaemonSet runs exactly one pod on each eligible node; when a node is added/removed, the pod is added/removed too.
- YAML:
apps/v1,kind: DaemonSet, selector + template; there is noreplicas. nodeSelector/nodeAffinityselect nodes;tolerationsallow tainted nodes.- Uses: log collection, monitoring, networking, storage and security agents; resource limits multiply with the node count.
- Updates:
RollingUpdate(maxUnavailable) orOnDelete; therolloutcommands work.
kubectl get ds -A
kubectl rollout status ds/node-exporter -n izlemePractice A collector on every node
Write a DaemonSet template's spec section (starting with spec:): under tolerations, key: node-role.kubernetes.io/control-plane, operator: Exists, effect: NoSchedule; container named fluent-bit, image fluent/fluent-bit:3.1.
Starter code
# buraya yazSample solution
spec:
tolerations:
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
containers:
- name: fluent-bit
image: fluent/fluent-bit:3.1Expected output
daemonset.apps/fluent-bit configured NAME DESIRED CURRENT READY fluent-bit 3 3 3
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 If a log-collector DaemonSet doesn't run on the control-plane node, what is the likely cause?
- The image is wrong
- The namespace is wrong
- There's no toleration for the NoSchedule taint on the node Correct answer
- replicas is missing
Explanation: Control-plane nodes are tainted by default.
2 Allow the taint.
____:
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
tolerations:
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
Explanation: tolerations let a pod be placed on a tainted node.
3 Match.
| Term | Meaning |
|---|---|
DaemonSet |
Per node |
nodeSelector |
Node selection |
tolerations |
Taint allowance |
OnDelete |
Controlled update |