问题描述
我是kubernetes和微服务的新手,有2个对象,部署和 ReplicaSet .
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.
如果有Deployments
,为什么需要ReplicaSet
,因为您可以在Deployment
中指定副本集.当我删除Pod时,将根据副本集生成新Pod,就像部署一样.
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.
就像我们只需要ReplicaSet
而不需要Deployments
Like what is the actual use-case where we only need ReplicaSet
but not Deployments
推荐答案
部署比ReplicaSet对象高一级.建议对应用程序服务进行部署.
Deployment works one level above ReplicaSet object. Deployment is recommended for application services.
通过部署,您应该能够进行滚动升级或回滚.您可以将图片从v1更新到v2.
With deployment you should be able to do rolling upgrade or rollback. You can update image from v1 to v2.
使用ReplicaSet,您可以定义要运行的副本数.对于特定的服务.您将运行那么多副本.
With ReplicaSet you define number of replicas you want to run. For a particular service. You would have those many replicas running.
这篇关于k8s-为什么在进行部署时我们需要ReplicaSet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!