Fix/Debug the Kubernetes LoadBalancer "pending" state in Docker Desktop for Windows

Fix/Debug the Kubernetes LoadBalancer "pending" state in Docker Desktop for Windows
Fix/Debug the Kubernetes LoadBalancer "pending" state in Docker Desktop for Windows

LoadBalancer with External-IP as "Pending"

If you are here looking at this post, then you must be using the Kubernetes cluster inside the Docker Desktop and having issues with any Ingress controller to work in your environment. I had faced the same issue and figured out the reason, and making this post to make it easy for you to troubleshoot the actual problem.

By default, once you install any ingress controller for the first time in the Kubernetes cluster. Kubernetes is going to expose the service as a LoadBalancer using host ports 80 and 443.

So if you check the status of Services deployed on the Server, you can find the ingress service (nginx, traefik, etc.) with a custom service name. If everything works as expected, then you will notice the status of the services (LadBalancer External-IP =  "localhost") as below.

However, if you face issues like me, then you may see the status as below (LadBalancer External-IP =  "pending").

If you are in the same situation, then you should first download the currports tool (freeware), from the official website to inspect your host ports.

It is a simple utility to monitor network traffic on Windows operating system. You can certainly use Powershell commands to do the same, but you won't get an overall view on ports currently accessed or used by other applications. So I suggest using the currports application (freeware) to look at what all ports are being used and by which applications.



If the ingress is working, then you should see a docker backend process listening to ports 80 and 443. But, if you don't see them being used by the docker backend, then you need to backtrace the application and kill that application. The ingress controller should automatically start listening once the other process is killed.

In my case, the issue was with the HTTP system service listening on ports 443 and 80. They have started listening since I installed IIS Express for my development work.

Temporary Fix: reassign HTTP listening IP

If you are also facing the issue with the HTTP system process, then you can run the below commands to release ports 80 and 443.

1. For listing HTTP ports:

netsh http show iplisten

2. For reassigning HTTP ports to different or dummy interfaces:

netsh http add iplisten X.X.X.X

3. For stop listening HTTP ports on the current interface:

netsh http delete iplisten 0.0.0.0

You may have to repeat it for all interfaces that it currently listens on.

Permanent Fix: Disable HTTP service

Open the registry editor (Start + R -> type "regedit" as command).


Navigate to below HKEY path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP

Change the value of "Start" to 4 (This is equivalent to Disabled state)

Reboot the system for changes to take effect, and verify the ports listening in currports application after a restart.

Validation

Once the issue is resolved, you can check the status of Kubernetes services, and verify that LoadBalancer external IP is now set to "localhost" as shown below.

Command: kubectl get services


Once the status is confirmed, you can open the browser on the host machine to confirm if you can access the ingress controller. For example, see below.


For a Traefik ingress controller, you can simply check the default certificate to tell if the response is served from the ingress controller or not.