Search code examples
dockerkuberneteslocalhostminikubenginx-ingress

Reaching running application in minikube at 'localhost' on Linux


I use --driver=docker and minikube tunnel in Windows (WSL2 and native) and macOS (Intel and M1) which makes the app running in the minikube cluster accessible in browser at localhost after applying ingress-nginx.

To make things consistent across Linux, macOS and Windows for a list of reasons that really aren't relevant to the question, I'd like to do the same in Linux (Ubuntu/Pop!_OS in particular).

I know Docker works differently with networking in Linux than it does with macOS and Windows, which is likely what is causing the issue.

For macOS and Windows, I'd normally just use the following which works regardless if using Docker Desktop or not:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.44.0/deploy/static/provider/cloud/deploy.yaml

For Linux, I've tried three different things:

# the recommended method for minikube (which doesn't work in macOS nor WIndows if using --driver=docker)
minikube addons enable ingress

# Docker Desktop
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.44.0/deploy/static/provider/cloud/deploy.yaml

# Bare Metal
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.44.0/deploy/static/provider/baremetal/deploy.yaml

The results, whether using minikube tunnel or not in Linux, are the same: "localhost refused to connect."

So my question is, which may be a question for ingress-nginx, is there a way to get the combination of minikube and ingress-nginx to serve the application at localhost in Linux like it does for Windows and macOS?

If not, I guess I need to be revise my dev deployment scripts to make this exception, but would like to avoid that if possible.


Solution

  • After short investigation it seems to me there is a wide problem related to minikube, --vm-driver=docker and ingress. And it seems it affects all the platforms, not only your specific case.

    There are 2 open issues on github related to this. Both are fresh and opened:

    1. Ingress on docker driver - minikube 1.16 - ERR_CONNECTION_REFUSED

    2. docker: Ingress not exposed on MacOS

    Are you able to use another --vm-driver?