How to get the service IP in Kubernetes? How to get the service IP in Kubernetes? kubernetes kubernetes

How to get the service IP in Kubernetes?


kubectl get service/servicename -o jsonpath='{.spec.clusterIP}'


kubectl get svc <your-service> -o yaml | grep ip


The IP should be the external IP of your master-node.If you're running locally it should be localhost or your VM.

Of course with the given port added.

127.0.0.1:80

for example.

PS: Be sure you have containers/pods running already by running:

kubectl get pods

If this doesn't work, I would suggest proxying it, for test-purposes at least.

Kubectl proxy