Daemonsets in K8's

Daemonsets in K8's

·

1 min read

What are Daemon sets??

Daemon Sets are Kubernetes cluster objects that act as replica sets, facilitating the deployment of multiple instances of pods. Specifically, they ensure that exactly one copy of the pod runs on each node within your cluster. As new nodes are added, Daemon Sets automatically generate copies of the pod to maintain consistent and distributed execution.

An introduction to Kubernetes DaemonSets

Use the following commands to list, describe, and delete DaemonSets in a Kubernetes cluster:

kubectl get daemonsets 
kubectl describe daemonset <daemonset-name>  
kubectl delete daemonset <daemonset-name>
# To list the daemonsets
# To delete the daemonset

How to create a daemonset?

Create a YAML manifest file for the creation of daemonset

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: nginx-daemonset
  labels:
    app: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx-container
        image: nginx:latest
kubectl apply -f nginx-daemonset.yaml

Use Cases:

  1. Monitoring and Logging: Every node gets its own monitoring and logging agent, ensuring a comprehensive view of the cluster's health.

  2. Networking and Security: Daemon Sets help deploy networking components and security tools on each node, creating a secure and well-connected environment.