从我在文档中可以看出, ReplicaSet
在运行 Deployment
时创建.它似乎支持 ReplicationController
的一些相同功能。 - 向上/向下扩展和自动重启,但不清楚它是否支持滚动升级或自动扩展。
v1.1.8 用户指南显示了如何在 Deploying Applications 中创建部署(它会自动创建一个 ReplicaSet
),但 kubectl get replicasets
命令在 v1.2.0 之前不可用。我找不到关于 ReplicaSet
的任何其他信息在文档中。
威尔ReplicaSet
最终替换 ReplicationController
?我为什么要使用 Deployment
和 ReplicaSet
而不是 ReplicationController
?
最佳答案
Replica Set 是下一代的 Replication Controller。复制 Controller 有点势在必行,但副本集尝试尽可能声明性。
1.现在副本集和复制 Controller 之间的主要区别是选择器支持。
+--------------------------------------------------+-----------------------------------------------------+
| Replica Set | Replication Controller |
+--------------------------------------------------+-----------------------------------------------------+
| Replica Set supports the new set-based selector. | Replication Controller only supports equality-based |
| This gives more flexibility. for eg: | selector. for eg: |
| environment in (production, qa) | environment = production |
| This selects all resources with key equal to | This selects all resources with key equal to |
| environment and value equal to production or qa | environment and value equal to production |
+--------------------------------------------------+-----------------------------------------------------+
2.第二件事是更新 pod 。
+-------------------------------------------------------+-----------------------------------------------+
| Replica Set | Replication Controller |
+-------------------------------------------------------+-----------------------------------------------+
| rollout command is used for updating the replica set. | rolling-update command is used for updating |
| Even though replica set can be used independently, | the replication controller. This replaces the |
| it is best used along with deployments which | specified replication controller with a new |
| makes them declarative. | replication controller by updating one pod |
| | at a time to use the new PodTemplate. |
+-------------------------------------------------------+-----------------------------------------------+
这是区分 RS 和 RC 的两件事。使用 RS 的部署被广泛使用,因为它更具声明性。
关于deployment - ReplicaSet 和 ReplicationController 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36220388/