在 Kubernetes 集群上缺乏共识到底会产生什么实际后果?或者换句话说:Kubernetes 集群上的哪些功能需要达成共识?什么有效,什么无效?
例如(实际上只是例如):
- 现有 Pod 会继续运行吗?
- Pod 仍然可以水平缩放吗?
示例场景:具有两个节点的集群丢失一个节点。不可能达成共识。
最佳答案
共识是 etcd 的基础,etcd 是 Kubernetes 构建的分布式数据库。如果没有达成共识,您可以从数据库读取,但不能写入。例如。如果 3 个节点中只有 1 个可用。
When you lose quorum etcd goes into a read only state where it can respond with data, but no new actions can take place since it will be unable to decide if the action is allowed.
Understanding Etcd Consensus and How to Recover from Failure
Kubernetes 的设计使得 pod 只需要 kubernetes 即可进行更改,例如部署。之后,它们以松散耦合的方式独立于 kubernetes 运行。
Kubernetes 的构建是为了在 etcd 数据库中保存所需状态。然后 Controller 观察 etcd 的变化并根据变化采取行动。这意味着如果 etcd 没有达成共识,您将无法扩展或更改 pod 的任何配置。 Kubernetes 做了很多 self 修复操作,但如果 etcd 不可用,这些操作将无法工作,因为所有操作都是通过 ApiServer 和 etcd 完成的。
Loosing quorum means that no new actions can take place. Everything that is running will continue to run until there is a failure.
关于kubernetes - Kubernetes 集群上缺乏共识的实际后果是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59073769/