协调领导者选举
More information about this feature
To use this feature, you (or a cluster administrator) will need to enable the CoordinatedLeaderElection feature gate for all relevant components in your cluster.
See Enable Or Disable Feature Gates for more information.
Kubernetes 1.35 包含一个 Beta 特性,
允许控制平面组件通过协调领导者选举确定性地选择一个领导者。
这对于在集群升级期间满足 Kubernetes 版本偏差约束非常有用。
目前,唯一内置的选择策略是 OldestEmulationVersion,
此策略会优先选择最低仿真版本作为领导者,其次按二进制版本选择领导者,最后会按创建时间戳选择领导者。
启用协调领导者选举
确保你在启动 API 服务器时
CoordinatedLeaderElection 特性门控被启用,
并且 coordination.k8s.io/v1beta1 API 组被启用。
此操作可以通过设置 --feature-gates="CoordinatedLeaderElection=true"
和 --runtime-config="coordination.k8s.io/v1beta1=true" 标志来完成。
组件配置
前提是你已启用 CoordinatedLeaderElection 特性门控并且
启用了 coordination.k8s.io/v1beta1 API 组,
兼容的控制平面组件会自动使用 LeaseCandidate 和 Lease API 根据需要选举领导者。
对于 Kubernetes 1.35, 当特性门控和 API 组被启用时, 两个控制平面组件(kube-controller-manager 和 kube-scheduler)会自动使用协调领导者选举。