I am trying to expose a kubernetes "deployment" via the kubectl expose
command, wih a static IP address, on Google Container Engine.
With an ephemeral IP, everything works fine:
kubectl expose deployment my-application \
--type="LoadBalancer" --port=80 --target-port=8080
I use kubectl get services
and wait a few minutes to see the ephemeral IP having been assigned. I enter the IP in my browser and I see the applicaiton, i.e. everything works.
However, when I do the following:
Create a static IP address using the gcloud web interface (Networking -> External IP addresses -> Reserve Static IP address)
Re-create the service with the same command as above but with the extra
--load-balancer-ip
optionkubectl expose deployment my-application \ --type="LoadBalancer" --port=80 --target-port=8080 \ --load-balancer-ip='1.2.3.4' # IP as assigned by web interface above
The command is successful, but the application is not reachable under that IP address, and when I use the following command:
$ kubectl get services
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
endpoints 10.119.247.39 <pending> 80/TCP 23m
kubernetes 10.119.240.1 <none> 443/TCP 1d
I see that the EXTERNAL-IP
is still <pending>
although I've waited 23 minutes so far.
What am I doing wrong?