Kubernetes- DaemonSet
A DaemonSet ensures that all (or some) Nodes run a copy of a Pod. As nodes are added to the cluster, Pods are added to them. As nodes are removed from the cluster, those Pods are garbage collected. Deleting a DaemonSet will clean up the Pods it created.
Some typical uses of a DaemonSet are:
- running a cluster storage daemon on every node
- running a logs collection daemon on every node
- running a node monitoring daemon on every node
In a simple case, one DaemonSet, covering all nodes, would be used for each type of daemon. A more complex setup might use multiple DaemonSets for a single type of daemon, but with different flags and/or different memory and cpu requests for different hardware types.
1. Deploy Pod on "all" worker nodes inside k8s cluster using DaemonSet
1a. YAML File:
1b. Create | Display | Validate
kubectl create -f nginx-ds-allnodes.yaml
kubectl get po -o wide
kubectl get ds
kubectl describe ds nginx-ds
kubectl delete ds nginx-ds
Deploy Pod on "Subset" of worker nodes inside k8s cluster using DaemonSet
Attach label to the nodes
kubectl get nodes
kubectl label nodes worker1 worker2 disktype=ssd
kubectl get nodes --show-labels
YAML
Create | Display | Validate
kubectl create -f nginx-ds-subsetnodes.yaml
kubectl get po -o wide
kubectl get ds
kubectl describe ds nginx-ds
Cleanup
kubectl delete ds nginx-ds
kubectl get po
Comments
Post a Comment