简体   繁体   中英

How to use service name instead of External IP/domain name for a service endpoint url in kubernetes

I have deployed application on my kubernetes cluster and I have exposed the service as well. As I am using AWS cloud, I got external IP (domain name) for particular service to access it.

While exposing the service I have mentioned the name to the service. Now I want to use service name, instead of external IP.

NAME             TYPE           CLUSTER-IP       EXTERNAL-IP    PORT(S)
Service1         LoadBalancer   1.x.x.x          test1.com      1000:3000/TCP
Service2         LoadBalancer   2.x.x.x          test2.com      2000:4000/TCP

Here, now I am using test1.com:1000 to access my application. But I want to use Service1:1000 to access my application. Can someone please help me with this?

You have 2 services behind ELB, and you can call you services only by test1.com:1000 from outside. If you call the service from inside the cluster, you can use service1:3000 as an endpoint because it is inside the cluster where kube-dns works, which resolves all these names inside the cluster.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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