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 in Kubernetes by Ali
• 10,400 points
776 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 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 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 in Kubernetes by Sirajul
• 25,220 points
74 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,280 points
564 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 in Kubernetes by DareDev
• 6,810 points
404 views
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

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

answered Jan 17 in Others by anonymous
2,096 views
+3 votes
1 answer
0 votes
1 answer