How can I access a service installed on Kubernetes from anywhere?

10/18/2016

I am working on a mac machine and installed the latest Kubernetes and followed the example here (this is for dev’t purpose). All went smooth but I was hoping that Kubernetes provide me an ip address and port number where my service will be listening to so that I can access it from anywhere.

Please correct me if I am wrong.

I was able to run ifconfig as well as curl $(minikube service hello-minikube --url) and I was able to see the ip address and port but I wasn’t able to access it outside command line where Kubernetes lives in.

The reason I am trying to access it outside the VM is because we have other projects that run on other machines and I wanted to call the REST service I installed while we are on dev env. This way we don’t have to wait until the service is pushed to production.

FYI: This is my first micro service project and I would appericiate your feedback.

-- WowBow
devops
java
kubernetes
microservices

1 Answer

10/18/2016

I followed the steps in the article you linked and it works as expected.

Just do:

minikube service hello-minikube --url

You will get a url like http://192.168.99.100:32382/ - the port and IP could and will change for you. Also note that the exposed port will be a random port like the 32382 and not 8080 that the pod uses.

Use the url in your browser, say and you should be able to see the output of the service.

-- manojlds
Source: StackOverflow