简体   繁体   English

使用主机名而不是 ip 地址访问 kuberntes 上的服务

[英]Access service on kuberntes using hostname instead of ip Address

I am using istio ingress gateway for one of my services, which has to be exposed to http requests.我正在为我的一项服务使用 istio 入口网关,该服务必须暴露给 http 请求。 I have configured gateway(myservice-gatewa) and virtual service(myservice-endpoints).我已经配置了网关(myservice-gatewa)和虚拟服务(myservice-endpoints)。 I am able to access service using http://{ingress_ip}:{ingress_port}/{path}.我可以使用 http://{ingress_ip}:{ingress_port}/{path} 访问服务。 But I want to access service using host name instead of any ip address.但我想使用主机名而不是任何 ip 地址访问服务。 how do I do it?我该怎么做? Thanks in advance提前致谢

If I understand your question correctly, You want to access your service from within your cluster via host name and not via IP ( Assuming service is of type NodePort).如果我正确理解您的问题,您希望通过主机名而不是通过 IP 从集群内访问您的服务(假设服务是 NodePort 类型)。 If yes have you considered looking up the Kubernetes documentation on DNS for Services and Pods?如果是,您是否考虑在 DNS 上查找服务和 Pod 的 Kubernetes 文档?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM