Kubernetes (docker-desktop) with multiple LoadBalancer services
I decided to copy my comments, as they partially explain the problem, and make a Community Wiki
answer out of them so it is more clearly seen and available for possible further edits by the Community:
It works probably exactly the same way as in Minikube. As docker-desktop is unable to provision real LoadBalancer
it can still "simulate" creating Service
of such type using NodePort
(this can easily be seen from port range it uses). I'm pretty sure you cannot use same IP address as the ExternalIP
of the LoadBalancer
Service
and if you create one more Service
of such type, your docker-desktop has no other choice than to use your localhost one more time. As it is already used by one Service
it cannot be used by another one and that's why it remains in a pending state
.
Note that if you create real LoadBalancer
in a cloud environment, each time new IP is provisioned and there is no situation that next LoadBalancer
you create gets the same IP that is already used by the existing one. Apparently here it cannot use any other IP then one of localhost
, and this one is already in use. Anyway I would recommend you to simply use NodePort
if you want to expose your Deployment
to the external world.
Think about using Ingress controller instead.
So basically, it's 3 steps after installing docker-desktop :
- Wilcard Certificate locally
- SSL certificate For local env
- Install Ingress Controller
Detailed here: https://github.com/kubernetes-tn/guideline-kubernetes-enterprise/blob/master/general/desktop-env-setup.md