Enable Ingress controller on Docker Desktop with WLS2
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
Running an ingress controller on Docker Desktop with WSL2 is a common local Kubernetes setup on Windows. The core job is to enable Docker Desktop's Kubernetes cluster, install an ingress controller such as ingress-nginx, and route a hostname on your machine to the controller so local traffic reaches your test service.
Enable Kubernetes in Docker Desktop
Before installing ingress, make sure Docker Desktop is using the WSL2 backend and Kubernetes is enabled. In Docker Desktop settings, the WSL2 integration and Kubernetes options both need to be turned on. After applying the settings, confirm that kubectl points to the Docker Desktop cluster.
You should see the docker-desktop context and at least one ready node. If this step fails, ingress installation is not the problem yet.
Install ingress-nginx
For local development, the ingress-nginx project is the most common controller. Apply the official deployment manifest and wait for the controller pods to become ready.
On Docker Desktop, the service is usually exposed through localhost. Check the controller service:
If the controller is running, you now have the component that reads Ingress resources and forwards traffic to services.
Deploy a Test Application
Use a very small application first so you can isolate ingress problems from application problems. This example deploys a demo HTTP container and exposes it as a ClusterIP service.
Apply it:
Create the Ingress Resource
Now define an ingress that routes a hostname to the service. The ingressClassName should match the installed controller.
Apply and inspect it:
Then add 127.0.0.1 hello-web.local to your Windows hosts file and test:
If everything is correct, the request should return the demo text.
Troubleshooting on Docker Desktop and WSL2
Most local ingress failures fall into a short list. If curl reaches nothing, verify the controller pod and the test service separately. If the service works through kubectl port-forward but not through the ingress hostname, the problem is in ingress or local name resolution, not in the app.
Useful commands:
If the ingress exists but there are no endpoints, the service selector does not match the pod labels. If the hostname does not resolve, the hosts-file entry is missing or incorrect.
Common Pitfalls
- Assuming Docker Desktop enables an ingress controller automatically.
- Skipping verification of the
docker-desktopKubernetes context before debugging manifests. - Forgetting to set
ingressClassNameto the controller you actually installed. - Testing the hostname before adding it to the local hosts file.
- Debugging the ingress first when the underlying service is not healthy.
Summary
- Start by enabling Kubernetes in Docker Desktop and confirming the
docker-desktopcontext works. - Install
ingress-nginxand verify its controller pods are ready. - Deploy a small service first so ingress debugging stays focused.
- Create an
Ingressresource withingressClassName: nginxand map a local hostname to127.0.0.1. - Use controller logs, service endpoints, and a direct service test to isolate failures quickly.
Related reading
- Enable SSL connection for Kubernetes Dashboard
- endpoints “default-http-backend” not found in Ingress resource
- Ensuring at most a single instance of job executing on Kubernetes and writing into Postgresql
- Error con Pods in Azure k8s Volume capability not supported
- Enterprise Library Unity vs Other IoC Containers
- entrypoint entrypoint.sh - docker compose
- Enable Lambda function to an S3 bucket using cloudformation
- Enable S3 ACL access for CloudFront logs

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.