Connected refused when trying to hit kubernetes nodeport service using minikube in win10

11/9/2019

I have a very simple springboot service deployed on minikube in windows 10.

C:\Software\Kubernetes>kubectl get deployments

NAME                 READY   UP-TO-DATE   AVAILABLE   AGE
myspringbootserver   1/1     1            1           68m

C:\Software\Kubernetes>kubectl get service

NAME                 TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
kubernetes           ClusterIP   10.96.0.1        <none>        443/TCP          49d
myspringbootserver   NodePort    10.110.179.207   <none>        9080:30451/TCP   6m50s

C:\Software\Kubernetes>minikube service myspringbootserver --url

http://192.168.99.101:30451

But when I try to hit the service from my chrome browser with url

http://192.168.99.101:30451/MySpringBootServer/heartbeat

getting connection refused exception.Not sure what is going wrong.Could anyone help to resolve it please?

enter image description here

-- Jaanesh
kubernetes
minikube

1 Answer

11/10/2019

can you curl/wget using the ip address of the pod? kubectl exec -it podname -- curl http://podip:9080/MySpringBootServer/heartbeat

if not,ensure the path is correct

if yes, make sure the pod exists as an endpoint of the service

kubectl get endpoints myspringbootserver

there is a good debugging document regarding services here:

https://kubernetes.io/docs/tasks/debug-application-cluster/debug-application/#debugging-services

-- iliefa
Source: StackOverflow