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. 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 24, 2018 in Kubernetes by Damon Salvatore
• 5,980 points
1,316 views

2 answers 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 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.

I hope the information would be helpful for you.

answered Jul 24, 2018 by Atul
• 10,240 points
0 votes

if u want to directly want to access your service u need to expose them via  a node port

apiVersion: v1
kind: Service
metadata:
  name: app-server
  labels:
    name: app-server
spec:
  type: NodePort
  sessionAffinity: ClientIP
  ports:
    - port: 443 # application Port
      nodePort: 31000 # external application access port of your choice
      protocol: TCP
      name: app-server-port
  selector:
    name: app-server # your deployment selector whatever your define your deployment name
answered Jul 26, 2020 by Akash Gupta

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, 2019 in Kubernetes by Sirajul
• 59,230 points
2,054 views
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,300 points
4,552 views
0 votes
1 answer
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, 2019 in Kubernetes by Sirajul
• 59,230 points
1,071 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

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

answered Jan 17, 2019 in Others by anonymous
15,474 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,034 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP