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

8/10/2018

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?

-- rajendra
kubernetes
kubernetes-ingress

1 Answer

8/13/2018

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.

-- Nick Rak
Source: StackOverflow