Contents

Kubernetes DaemonSet

What is the DaemonSet?

DaemonSet
The DaemonSet is working for managing PODs that you need to deploy or delete all Nodes in the cluster.
That means, when you add a Node in the cluster or delete one of them, DeaemonSet is deploying or deleting POD to the Node.

How to work DaemonSet in Kubernetes

Behavior till v1.12
The Kubernetes uses nodeName property.
From v1.12
The Kubernetes uses default scheduler and NodeAffinity property.

DaemonSet YAML

ds-definition.ylm

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: monitoring-daemon
  namespace: kube-system
spec:
  selector:
    matchLabels:
      app: monitoring-agent
  template:
    metadata:
      labels:
        app: monitoring-agent
    spec:
      containers:
        - name: monitoring-agent
          image: monitoring-agent

Easy way to make a YAML

1
kubectl create deployment monitoring-daemon --image=monitoring-agent --dry-run=client -o yaml > ds.yml

After then, you can change the file like above.

Create a DaemonSet

1
kubectl create -f ds-definition.yml

DaemonSet List

1
2
3
kubectl get daemonsets

kubectl get ds

DaemonSet Detail

1
kubectl describe daemonset monitoring-daemon

Check How many PODs deploy to the cluster

1
2
3
4
5
# Check Nodes
kubectl get nodes

# Check PODs
kubectl -n kube-system get pods -o wide | grep proxy