k8s - 当我们有部署时为什么我们需要 ReplicaSet [英] k8s - Why we need ReplicaSet when we have Deployments

查看:39
本文介绍了k8s - 当我们有部署时为什么我们需要 ReplicaSet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 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

推荐答案

Deployment 比 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆