Kubernetes: Daemon Sets

Updated: Sep 15, 2020




In the last article we studied about resource limits for pods. Now let us discuss about another object type in Kubernetes i.e. Daemon Sets




Daemon set is an object like Replica set which runs multiple pods on different nodes. But the behavior of Daemon set is different. Daemon set runs one copy of pod on each and every node. Whenever a new node is added to the cluster, daemon set automatically creates a pod on that node and when a node is removed pod is removed as well.


In short , if we want that a pod should run on every node on a cluster, we have to deploy it as daemon set.

The daemon set definition file is similar to Replica set. Here is an example.



apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: frontend
  labels:
    app: guestbook
    tier: frontend
spec:
  selector:
    matchLabels:
      tier: frontend
  template:
    metadata:
      labels:
        tier: frontend
    spec:
      containers:
      - name: php-redis
        image: gcr.io/google_samples/gb-frontend:v3
[root@node1 kubernetes]# kubectl create -f daemon-set.yaml

## This will create frontend pod on every node
  


Only focus on the highlighted ones which came up together as a part of creating daemon set. For 2 worker nodes there are 2 pods.


OK people, let us keep it simple and short. In the next article we are going to read about static pods.









233 views0 comments

Recent Posts

See All
 

Subscribe Form

©2020 by Linux Advise