top of page

External-IP in "pending" state for LoadBalancer Type in Kubernetes


Consider you have installed Docker on Desktop for Windows and enabled Kubernetes (K8s) to start your learning journey in the container orchestration world.

You experimented with K8s Pods and your first "my-nginx" (usually the "Hello World" scenario for most starting for the first time) is working fine - Great!


Onto K8s services! You want to expose this outside your cluster to run your machine's browser and hence decided to use LoadBalancer. 

An absolute basic YAML construct for this should look like below -



You save this in a .yaml file and executed the kubectl command against it to create the service. Now, you run the below command and see the External-IP column showing "pending".... bam!


After a lot of Gooogling with various experimenting and troubleshooting methods shared by the good samaritans on the web, however, you still not able to somehow fix this. 

You are not alone, I faced this too!


I checked my kube config by executing below command - 

kubectl config view

What you should be seeing is below -

In my case, I had several clusters, contexts and users! (part of my other experimentation with AKS). Important to check above is the "current-context". In my case, it was related to AKS as part of above. Run below command to set the correct context.


kubectl config use-context docker-desktop

Yep, that should do it. Now, just delete the service and create this again, you should see the External-IP to localhost now.

With the port you exposed, try localhost:8080 on the browser and continue learning! 😊

コメント


bottom of page