external ip either goes pending or the assigned ip is not working

7/19/2019

I deployed my service with the command kubectl expose deployment hotspot-deployment --type=LoadBalancer --port=8080 and the external-ip was pending:

hotspot-deployment   LoadBalancer   10.104.104.81   <pending>     8080:31904/TCP   1m
kubernetes           ClusterIP      10.96.0.1       <none>        443/TCP          18m

After searching for it's solution, I assigned the external ip to my service with: kubectl patch svc hotspot-deployment -p '{"spec": {"type": "LoadBalancer", "externalIPs":["192.168.98.103"]}}' and the ip got assigned:

hotspot-deployment   LoadBalancer   10.106.137.71   192.168.98.103   8080:31354/TCP   12m
kubernetes           ClusterIP      10.96.0.1       <none>           443/TCP          35m

Now, when I try to hit my service using the URL: http://192.168.98.103:8080

The page doesn't open. I tried debugging with minikube tunnel , it shows:

    machine: minikube
    pid: 33058
    route: 10.96.0.0/12 -> 192.168.99.105
    minikube: Running
    services: [hotspot-deployment]
    errors: 
        minikube: no errors
        router: no errors
        loadbalancer emulator: no errors

Please help!

-- PRERNA AGARWAL
kubernetes
macos-mojave
minikube

1 Answer

7/22/2019

First of all, you can not expose your service in minikube with LoadBalanser type because it intended to use cloud provider’s load balancer

You should rather use service command:

minikube service hotspot-deployment --url

Then open url in your browser

-- A_Suh
Source: StackOverflow