Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

k8s - Why we need ReplicaSet when we have Deployments

I am new to kubernetes and microservices, there are 2 objects, Deployments and ReplicaSet.

I can't wrap my head around even after reading its documentations and other articles.

If we have Deployments, why do we need a ReplicaSet because you can specify the replicaset in the Deployment. And when i delete the pods, new pods will be spawned based on the replicaset, just like the deployments.

Like what is the actual use-case where we only need ReplicaSet but not Deployments

like image 421
hades Avatar asked Mar 31 '19 02:03

hades


2 Answers

Deployment works one level above ReplicaSet object. Deployment is recommended for application services.

With deployment you should be able to do rolling upgrade or rollback. You can update image from v1 to v2.

With ReplicaSet you define number of replicas you want to run. For a particular service. You would have those many replicas running.

like image 106
P Ekambaram Avatar answered Sep 21 '22 00:09

P Ekambaram


deployment is for stateless application and we can update our application by it. by replicaset we can not update our application easily and it has a lot of work to do to update our application.

like image 44
yasin lachini Avatar answered Sep 21 '22 00:09

yasin lachini