[英]how to use service IP address at Kubernetes instead of POD IP address
Normally I use POD IP address at my application to register the service.通常我在我的应用程序中使用 POD IP 地址来注册服务。 But unfortunately, when some problems happened at the POD, it changes automatically.但不幸的是,当 POD 发生一些问题时,它会自动更改。 Therefore I need to register service IP address instead of POD IP address at application.yml file of Kubernetes.因此,我需要在 Kubernetes 的 application.yml 文件中注册服务 IP 地址而不是 POD IP 地址。 What is your opinion to achieve this?您对实现这一目标有何看法?
Thank you谢谢
REgards问候
You can use service IP but service IP will change if you delete the service and recreate it.您可以使用服务 IP 但如果您删除并重新创建服务,服务 IP 将会更改。 Even better is to use service name because name will not change and Kubernetes DNS system will resolve the name to service IP automatically.更好的是使用服务名称,因为名称不会改变,Kubernetes DNS 系统会自动解析名称以服务 IP。
You could Register a headless Service which is made to resolve to all IPs of the corresponding pods Without providing a new IP.您可以注册一个无头服务,该服务用于解析相应 pod 的所有 IP,而无需提供新的 IP。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.