Understanding ๐the difference between Deployment and ReplicaSet โ in Kubernetes
Introduction:
Kubernetes is an open-source compartment arrangement stage that robotizes the sending, scaling, and boarding of containerized applications. Two important Kubernetes objects are deployment and replica set, which are used to manage pods, the smallest deployable units. Although they share some similarities, their features and application scenarios are fundamentally different.
In this blog post, we'll talk about the differences between Kubernetes deployment and replica set.
Small Intro to Deployment and ReplicaSet:
โผ In Kubernetes, deployment and replicaSet are two crucial components that aid in application lifecycle management and high availability.
โผ ReplicaSet ensures that a predetermined number of replica Pods are always running, while Deployment is in charge of managing the creation, scaling, and updating of ReplicaSets.
โผ By utilizing these parts, Kubernetes can without much of a stretch deal with the application lifecycle, guarantee adaptation to non-critical failure, and give consistent updates and rollbacks.
๐ณ๐๐๐๐๐๐๐๐๐ ๐๐๐๐ ๐๐๐ ๐๐๐๐๐๐๐๐๐๐ & ๐ณ๐๐๐๐๐ข๐๐๐๐?
๐ฅ๐ฒ๐ฝ๐น๐ถ๐ฐ๐ฎ๐ฆ๐ฒ๐:
โ It is a simpler object and is responsible only for maintaining a specific number of replicas of a pod.
โก It does not support rolling updates and rollbacks of application versions.
โข It is used for scaling a single type of Pod.
โฃ It's a lower-level resource than a Deployment and is mainly used by Deployments to manage replicas.
๐๐ฒ๐ฝ๐น๐ผ๐๐บ๐ฒ๐ป๐:
โ It provides a way to manage the lifecycle of ReplicaSets and Pods.
โก It supports rolling updates, rollbacks, and scaling of application replicas.
โข It is used for managing multiple ReplicaSets and scaling different types of Pods.
๐ฅ๐ผ๐น๐น๐ผ๐๐:
If there are problems in the deployment, Kubernetes will automatically roll-back to the previous version,
however we can also explicitly role-back to a specific revision
Example:
Rollout to the previous version(one version back):
โฃ ๐ฌ๐ถ๐ฃ๐ฆ๐ค๐ต๐ญ ๐ณ๐ฐ๐ญ๐ญ๐ฐ๐ถ๐ต ๐ถ๐ฏ๐ฅ๐ฐ ๐ฅ๐ฆ๐ฑ๐ญ๐ฐ๐บ/๐ฎ๐บ๐ฅ๐ฆ๐ฑ๐ญ๐ฐ๐บ๐ฎ๐ฆ๐ฏ๐ต
Rollout to a specific version:
โฃ kubectl rollout undo deploy/mydeployment --to-revision=2
To check whether the deployment was created or not :
โฃ kubectl get deploy
To check, how deployment creates Replicaset and pods:
โฃ kubectl describe deploy mydeployment
To scale replica through the command:
โฃ kubectl get rs
(rs= replica set)
โฃ kubectl scale --replicas=6 deploy mydeployment
To check how many versions you have created
โฃ kubectl rollout history deployment{or deploy} mydeployment
For deleting Deployment: kubectl delete deployment mydeployment
๐๐ต๐ฒ๐ป ๐ผ๐๐ฟ ๐ฑ๐ฒ๐ฝ๐น๐ผ๐๐บ๐ฒ๐ป๐ ๐ฐ๐ผ๐๐น๐ฑ ๐ณ๐ฎ๐ถ๐น๐ฒ๐ฑ ?
1. Insufficient quota: the required resources are not allocated.
2. readiness prob failures: let's say a node is not ready while applying deployment
3. Image pull error: due to version, image not available etc.
4. Insufficient permission
5. Limit Ranges
6. Application runtime misconfiguration
๐๐ฒ๐ฝ๐น๐ผ๐๐บ๐ฒ๐ป๐ ๐ณ๐ถ๐น๐ฒ:
๐๐ฒ๐ฝ๐น๐ผ๐๐บ๐ฒ๐ป๐ ๐ณ๐ถ๐น๐ฒ:
๐ ๐๐ฃ๐: ๐ฟ๐๐ฅ๐ก๐ค๐ฎ๐ข๐๐ฃ๐ฉ
๐๐ฅ๐๐๐๐ง๐จ๐๐ค๐ฃ: ๐๐ฅ๐ฅ๐จ/๐ซ1
๐ข๐๐ฉ๐๐๐๐ฉ๐:
๐ฃ๐๐ข๐: ๐ข๐ฎ๐๐๐ฅ๐ก๐ค๐ฎ๐ข๐๐ฃ๐ฉ๐จ
๐จ๐ฅ๐๐:
๐ง๐๐ฅ๐ก๐๐๐๐จ: 2
๐จ๐๐ก๐๐๐ฉ๐ค๐ง:
๐ข๐๐ฉ๐๐๐๐๐๐๐ก๐จ:
๐ฃ๐๐ข๐: ๐๐๐ฅ๐ก๐ค๐ฎ๐ข๐๐ฃ๐ฉ
๐ฉ๐๐ข๐ฅ๐ก๐๐ฉ๐:
๐ข๐๐ฉ๐๐๐๐ฉ๐:
๐ฃ๐๐ข๐: ๐ฉ๐๐จ๐ฉ๐ฅ๐ค๐
๐ก๐๐๐๐ก๐จ:
๐ฃ๐๐ข๐: ๐๐๐ฅ๐ก๐ค๐ฎ๐ข๐๐ฃ๐ฉ
๐จ๐ฅ๐๐:
๐๐ค๐ฃ๐ฉ๐๐๐ฃ๐๐ง๐จ:
- ๐ฃ๐๐ข๐: ๐00
๐๐ข๐๐๐: ๐ช๐๐ช๐ฃ๐ฉ๐ช
๐๐ค๐ข๐ข๐๐ฃ๐: ["/๐๐๐ฃ/๐๐๐จ๐", "-๐", "๐ฌ๐๐๐ก๐ ๐ฉ๐ง๐ช๐; ๐๐ค ๐๐๐๐ค ๐ฟ๐๐๐ฉ๐-๐๐ค๐ฉ๐; ๐จ๐ก๐๐๐ฅ 5; ๐๐ค๐ฃ๐"]
Subscribe to my newsletter
Read articles from Manish Syal directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by