DEV Community

Heidi Harding
Heidi Harding

Posted on • Edited on

Ingress in Kubernetes with Docker for Windows

-- Edited: They've now included information in the official documentation relating to setting up an ingress controller in Docker Desktop for mac and windows: https://kubernetes.github.io/ingress-nginx/deploy/#docker-desktop
This remains as an archive

I am currently in the process of moving my dev systems from my 2017 Macbook Pro over to my new X1 Extreme gen. 2. On the Mac I had previously used minikube for my Kubernetes needs but I wanted to use the Docker for Windows Kubernetes option instead.

Enabling an Ingress controller was a fairly straight forward affair with minikube. Simply use:
minikube addons enable ingress
and there you go. kubectl get pods should then list your controller and it was automatically available from outside of your cluster.

I spent several hours trying to get an Ingress controller to work under Windows. Ultimately it was just as easy as minikube, however it really wasn't obvious. Therefore, I decided to pen this short article in case anyone else is experiencing the same problem.

In the documentation for the Nginx Ingress controller it states that you must run the mandatory command:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml

If you perform this step on its own, you will end up with an empty Address when entering: kubectl describe ing because there is no service connecting the pod to the outside world.

There is no further information on this page for how to install a service for Windows, however if you follow the Docker for Mac instructions then it will work just fine. The following command made everything start up perfectly for me:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/cloud-generic.yaml

I am running with Docker for Windows version 2.1.0.3 stable using WSL.

I hope this helps someone :)

Top comments (4)

Collapse
 
albertmarashi profile image
AlbertMarashi

Can't believe the docs didn't state this, but you have to run this command in order for the ingress to work:

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

(taken from below)

Collapse
 
katzekat profile image
Heidi Harding

They've now included the necessary information for Docker Desktop in the official docs:
kubernetes.github.io/ingress-nginx...

Collapse
 
joebadmus profile image
joebadmus

Good work!!
The url 'raw.githubusercontent.com/kubernet...'.
Do you mind updating it?

Collapse
 
ztickm profile image
Salim MAHBOUBI

Hello !
Thanks for pointing out that the url is dead.
Can you try this new one and see if it works?

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