k8s - Why we need ReplicaSet when we have Deployments

3/31/2019

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

-- hades
kubernetes
microservices

2 Answers

3/31/2019

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.

-- P Ekambaram
Source: StackOverflow

3/31/2019

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.

-- yasin lachini
Source: StackOverflow