💡
原文英文,约1100词,阅读约需4分钟。
📝
内容提要
Kubernetes的Endpoints API在1.33版本中被弃用,用户需迁移至EndpointSlices。EndpointSlices支持双栈网络和流量分配,每个服务可关联多个EndpointSlices。迁移时需更新代码和配置以适应新API。
🎯
关键要点
- Kubernetes的Endpoints API在1.33版本中被弃用,用户需迁移至EndpointSlices。
- EndpointSlices支持双栈网络和流量分配,每个服务可关联多个EndpointSlices。
- 迁移时需更新代码和配置以适应新API。
- Endpoints API仅用于避免破坏仍在使用的用户工作负载和脚本。
- EndpointSlices与Endpoints的主要区别在于每个服务可以有多个EndpointSlices。
- 双栈服务会有单独的EndpointSlices用于IPv4和IPv6。
- EndpointSlices中的所有端点必须针对相同的端口。
- 当服务的端点超过100个时,EndpointSlice控制器会将端点拆分为多个EndpointSlices。
- 获取EndpointSlices时需使用标签选择器而非名称。
- 生成EndpointSlices时需更新YAML或Go代码以使用新类型。
- EndpointSlices允许每个端点有条件(如'准备:假')与之关联。
- 迁移后可以使用EndpointSlice特有的功能,如拓扑提示和终止端点。
❓
延伸问答
Kubernetes的Endpoints API为什么被弃用?
Endpoints API在Kubernetes 1.33版本中被弃用,主要是因为用户需要迁移到支持新特性的EndpointSlices。
EndpointSlices与Endpoints的主要区别是什么?
EndpointSlices允许每个服务关联多个切片,而Endpoints每个服务仅有一个对象,且EndpointSlices支持双栈网络。
如何迁移到EndpointSlices?
迁移时需更新代码和配置,使用标签选择器获取EndpointSlices,并在YAML或Go代码中使用新类型。
EndpointSlices支持哪些新特性?
EndpointSlices支持双栈网络、流量分配、拓扑提示和终止端点等新特性。
在使用EndpointSlices时,如何处理超过100个端点的情况?
当服务的端点超过100个时,EndpointSlice控制器会将端点拆分为多个EndpointSlices。
如何在代码中获取EndpointSlices?
可以使用标签选择器获取EndpointSlices,例如:kubectl get endpointslice -l kubernetes.io/service-name=myservice。
➡️