简体   繁体   English

如何使用服务 IP 地址在 Kubernetes 代替 POD IP 地址

[英]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.

相关问题 Kubernetes - 服务群集IP地址与Pod IP地址 - Kubernetes - service cluster IP address vs Pod IP address Kubernetes:如何配置hostnetwork pod IP 地址? - Kubernetes: How to configure hostnetwork pod IP address? 在kubernetes中,POD将具有IP地址,而Node将具有IP地址 - In kubernetes POD will have IP address and Node will have IP address 获取Kubernetes中Pod的外部可访问IP地址 - Get Externally accessible IP address of Pod in Kubernetes 如何将kubernetes pod的主机名设置为其IP地址? - How to set a kubernetes pod's hostname to its IP address? 如何通过查询DNS srv记录获取kubernetes pod的IP地址? - How to obtain Ip address of a kubernetes pod by querying DNS srv records? Kubernetes:如何将 static IP 地址或主机名分配给节点和 POD - Kubernetes : How to assign static IP address or HostName to node and POD Kubernetes NFS:使用服务名称而不是硬编码的服务器IP地址 - Kubernetes NFS: Using service name instead of hardcoded server IP address Kubernetes 工作节点 IP 地址和 Pod IP 之间的关系 - Kubernetes relation between worker node IP address and Pod IP 我可以在 Kubernetes Ingress 中使用 ip 地址代替域名吗? - Can I use ip address in Kubernetes Ingress instead of domain name?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM