Search code examples
kubernetesload-balancingminikubehaproxy-ingress

Cannot export a IP in minikube and haproxy loadBalancer


I'm newer with kubernetes. I've installed minikube v1.5.2 in a virtualbox VM (ubuntu 19.10). I want to create a web server that I can access from the host and guest. However, I can't access it or expose an IP. Could you help me?

I've already enabled the ingress addons.

When I try list the ingress object there is no external IP and I recive this error message from ingress controller deployment:

2019/11/10 15:41:04 controller-haproxy.go:147 service does not exists
2019/11/10 15:41:09 controller.go:333: service  does not exists
2019/11/10 15:41:09 controller-haproxy.go:147 service  does not exists
2019/11/10 15:41:14 controller.go:333: service  does not exists
2019/11/10 15:41:14 controller-haproxy.go:147 service  does not exists

This is my code: https://pastebin.com/ysMPtyuV


Solution

  • Minikube introduced supporting of LoadBalancer via minikube tunnel.

    When you are not using $ sudo minikube tunnel your LB service will be in pending state whole time.

    You need to open another SSH window and run $ sudo minikube tunnel. You will receive output in one SSH like:

    $ sudo minikube tunnel
    Status:
            machine: minikube
            pid: 11549
            route: 10.96.0.0/12 -> 10.132.15.208
            minikube: Running
            services: [haproxy-ingress]
        errors: 
                    minikube: no errors
                    router: no errors
                    loadbalancer emulator: no errors
    

    In the second SSH you will be able to check that LB service obtain IP address.

    minikube:~$ kubectl get svc -w
    NAME              TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
    app               ClusterIP      10.105.136.11   <none>        80/TCP         68s
    haproxy-ingress   LoadBalancer   10.111.24.111   <pending>     80:31187/TCP   68s
    kubernetes        ClusterIP      10.96.0.1       <none>        443/TCP        11d
    haproxy-ingress   LoadBalancer   10.111.24.111   10.111.24.111   80:31187/TCP   80s
    

    Please keep in mind that minikube tunnel session must be opened whole the time otherwise your LB will stop getting IP address.

    You can check similar case with Kong using minikube LB.

    Let me know if that helped you.