How do I access a service on a kubernetes node from another node on the same cluster?

1/15/2019

My service description:

kubernetes describe service app-checklot --namespace=app-test-gl

Name:              app-checklot
Namespace:         app-test-gl
Labels:            app=app-checklot
                   chart=app-checklot-0.1.0
                   heritage=Tiller
                   release=chkl
Annotations:       <none>
Selector:          app=app-checklot,release=chkl
Type:              ClusterIP
IP:                10.99.252.76
Port:              https  11080/TCP
TargetPort:        11080/TCP
Endpoints:         85.101.213.102:11080,85.101.213.103:11080
Session Affinity:  None
Events:            <none>

I am able to access the pods separately using the individual ip's:

http://85.101.213.102:11080/service
http://85.101.213.103:11080/service

Also the service using the IP (this needs to be configured from another node by means of the url):

http://10.99.252.76:11080/service

What I would want is to access the service (app-checklot) using the service name in the url - so that I needn't update the url always . Is this possible? If so, how?

-- Chillax
kubernetes
kubernetes-helm
kubernetes-service

2 Answers

1/15/2019

From Documentation:

For example, if you have a Service called "my-service" in a Kubernetes Namespace called "my-ns", a DNS record for "my-service.my-ns" is created. Pods which exist in the "my-ns" Namespace should be able to find it by simply doing a name lookup for "my-service". Pods which exist in other Namespaces must qualify the name as "my-service.my-ns". The result of these name lookups is the cluster IP.

Another service, deployed to the same namespace, would be able to call http://app-checklot/service.

-- edbighead
Source: StackOverflow

1/15/2019

Yes, from within the cluster your service should be available at:

http://app-checklot.app-test-gl:11080/service
-- Michael Hausenblas
Source: StackOverflow