Kubernetes v1.36:Cloud Controller Manager 中新增路由同步指标

来源: Kubernetes Blog
原文链接: https://kubernetes.io/blog/2026/blog/2026/05/15/ccm-new-metric-route-sync-total/


本文最初发布日期有误,后于2026年5月15日重新发布。

Kubernetes v1.36 为 Cloud Controller Manager(CCM,云控制器管理器)的路由控制器实现引入了一个新的 alpha 计数器指标 route_controller_route_sync_total,代码位于 k8s.io/cloud-provider。每当与云提供商同步路由时,该指标就会递增。

基于 watch ️ 基于 Watch 的路由协调的 A/B 测试

此指标的引入旨在帮助运维人员验证 Kubernetes v1.35 中引入的 CloudControllerManagerWatchBasedRoutesReconciliation 特性门控。该特性门控将路由控制器从固定间隔轮询切换为基于 Watch(监听)的方式,仅在节点实际发生变化时才进行协调。这减少了对基础设施提供商的不必要 API 调用,降低了速率受限 API 的压力,使运维人员能够更高效地利用可用配额。

要进行 A/B 测试,请比较该特性门控禁用(默认)与默认值相同)和启用时 route_controller_route_sync_total 的指标值。在节点变更不频繁的集群中,启用该特性门控后,同步速率应显著下降。

示例:预期行为

禁用特性门控时(默认的固定间隔轮询),无论节点是否发生变化,计数器都会稳步递增:

After 10 minutes with no node changes

route_controller_route_sync_total 60

After 20 minutes, still no node changes

route_controller_route_sync_total 120

启用该特性门控(feature gate)(基于监听的调谐 (watch-based reconciliation)),计数器仅在节点被实际添加、移除或更新时递增:

After 10 minutes with no node changes

route_controller_route_sync_total 1

After 20 minutes, still no node changes — counter unchanged

route_controller_route_sync_total 1

A new node joins the cluster — counter increments

route_controller_route_sync_total 2
`

这种差异在节点很少变化的稳定集群(stable clusters)中尤为明显。

我可以在哪里提供反馈?

如果你有任何反馈,欢迎通过以下渠道联系我们:

如何了解更多信息?

更多详情,请参阅 KEP-5237-5237。