About Lesson
Overview:
DaemonSets ensure that a copy of a Pod runs on all (or specific) Nodes in a cluster.
Use Cases:
-
Running logging or monitoring agents (e.g., Fluentd, Prometheus Node Exporter).
-
Running system-level tasks.
Example DaemonSet YAML Manifest:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: daemonset-example
spec:
selector:
matchLabels:
app: example
template:
metadata:
labels:
app: example
spec:
containers:
- name: example-container
image: busybox
command:
- /bin/sh
- -c
- "while true; do echo Hello from DaemonSet; sleep 3600; done"
Steps to Deploy:
-
Apply the DaemonSet:
kubectl apply -f daemonset.yaml
-
Verify DaemonSet Pods:
kubectl get pods -o wide
-
Check Node Placement:
kubectl describe daemonset daemonset-example
Activity:
Deploy a DaemonSet to run a logging agent on all cluster Nodes. Verify the Pods are running on each Node.