k8s - Why we need ReplicaSet when we have Deployments

廉价感情. 提交于 2019-12-02 04:28:51

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/55437390/k8s-why-we-need-replicaset-when-we-have-deployments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!