- Take me to Video Tutorial
In this section, we will take a look at DaemonSets.
DaemonSets are like replicasets, as it helps in to deploy multiple instances of pod. But it runs one copy of your pod on each node in your cluster.
-
Creating a DaemonSet is similar to the ReplicaSet creation process.
-
For DaemonSets, we start with apiVersion, kind as
DaemonSets
instead ofReplicaSet
, metadata and spec.apiVersion: apps/v1 kind: Replicaset metadata: name: monitoring-daemon labels: app: nginx spec: selector: matchLabels: app: monitoring-agent template: metadata: labels: app: monitoring-agent spec: containers: - name: monitoring-agent image: monitoring-agent
apiVersion: apps/v1 kind: DaemonSet metadata: name: monitoring-daemon labels: app: nginx spec: selector: matchLabels: app: monitoring-agent template: metadata: labels: app: monitoring-agent spec: containers: - name: monitoring-agent image: monitoring-agent
-
To create a daemonset from a defination file
$ kubectl create -f daemon-set-defination.yaml