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

0 votes

I am trying to configure kubernetes and I have a mac machine and installed the latest Kubernetes and followed the example here. All went smooth but I was hoping that Kubernetes will 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.

Can anyone help me with this ?

Jul 23, 2018 in Kubernetes by Damon Salvatore
• 5,510 points

1 answer to this question.

0 votes

I have followed the link which you have attached and it works as expected.

Here is a command which you can use:

minikube service hello-minikube --url

You will get a url like - 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.

I hope the information would be helpful for you.

answered Jul 23, 2018 by Atul
• 10,240 points

Related Questions In Kubernetes

0 votes
1 answer

how can i access two containers that are inside a pod from the browser with IP address?

Just do port forward. kubectl port-forward [nginx-pod-name] 80:80 kubectl ...READ MORE

answered Jul 18 in Kubernetes by Sirajul
• 30,140 points
0 votes
1 answer

How can I stop a replicaset from restarting after deleting?

You need to delete the corresponding deployment. ...READ MORE

answered Dec 31, 2018 in Kubernetes by ajs3033
• 7,280 points
0 votes
1 answer

How can i get all the pods on a node?

You can use the following command to ...READ MORE

answered Jul 12 in Kubernetes by Sirajul
• 30,140 points
0 votes
1 answer
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
+3 votes
1 answer