Difference between a Deployment and a DaemonSet in Kubernetes

0 votes
What is the difference between a Deployment and a DaemonSet in Kubernetes?
Jan 6, 2019 in Kubernetes by Ali
• 11,360 points
4,442 views

2 answers to this question.

0 votes

Hey @Ali, 

A deployment provides declarative updates for replicasets and pods. What are declarative updates? So basically, you describe the desired state in your deployment object and the deployment controller will change the actual state to the desired state in a very controlled fashion. 

Use-cases:

  • Create a replicationController
  • Declare a new state of the pod
  • Rollback feature can be used
  • scaling for efficient deployment can be used
  • Clean-up older replicaSets
answered Jan 6, 2019 by Rohit
0 votes

Adding to @Rohit's answer, I'll explain about the daemonSet. DaemonSet ensures that all nodes are running a copy of the pods. If new nodes are added to the cluster, pods get equally distributed amongst the newly added nodes. This is taken care of by the DaemonSet. 

DeamonSet yaml look something like this:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: daemonset
  namespace: kube-system
  labels:
    k8s-app: fluentd-logging
spec:
  selector:
    matchLabels:
      name: daemonset
  template:
    metadata:
      labels:
        name: daemonset
    spec:
      tolerations:
      - key: node-role.kubernetes.io/master
        effect: NoSchedule
      containers:
      - name: daemonset
        image: k8s.gcr.io/fluentd-elasticsearch:1.20
        resources:
          limits:
            memory: 200Mi
          requests:
            cpu: 100m
            memory: 200Mi
        volumeMounts:
        - name: varlog
          mountPath: /var/log
        - name: varlibdockercontainers
          mountPath: /var/lib/docker/containers
          readOnly: true
      terminationGracePeriodSeconds: 30
      volumes:
      - name: varlog
        hostPath:
          path: /var/log
      - name: varlibdockercontainers
        hostPath:
          path: /var/lib/docker/containers
answered Jan 6, 2019 by Ramya

Related Questions In Kubernetes

0 votes
1 answer

What is the difference between config map and secret in kubernetes?

Config maps ideally stores application configuration in ...READ MORE

answered Jul 17, 2019 in Kubernetes by Sirajul
• 59,230 points
3,449 views
0 votes
1 answer

What's the difference betweena a deployment and a stateful set?

Both the deployments and replication controllers are ...READ MORE

answered Oct 3, 2018 in Kubernetes by ajs3033
• 7,300 points
4,205 views
0 votes
1 answer

What's the difference between kubernetes load balancer and ingress controller?

Load Balancer: So Kubernetes LoadBalancer just points ...READ MORE

answered Jan 4, 2019 in Kubernetes by DareDev
• 6,890 points
13,494 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
14,579 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 12, 2019 in Kubernetes by Kalgi
• 52,360 points

reshown Apr 12, 2019 by Kalgi 6,059 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP