Error creating GCE load balancer: requested address ip is neither static nor assigned to LB
Solution 1:
I had a similar problem. It turns out that if the IP address is reserved as global then it won't work. I deleted my reservation and changed it to the same region as my kubernetes cluster. --global
I had to use --region europe-west2
- the same region as my k8s cluster.
before: fail
gcloud compute addresses create my-secure-sftp --global
after: success
gcloud compute addresses create my-secure-sftp --region europe-west2
@see https://github.com/kubernetes/kubernetes/issues/22721 for more details
Solution 2:
The problem was in Deployment.yaml
where I was referring to the address under loadBalancerIp
by its symbolic name rather than the numeric IP address (NAME
and ADDRESS
as revealed by gcloud compute addresses list
respectively). If I use the numeric IP address instead, the load balancer comes up my service can be accessed externally at this address (via the load balancer). (This previous answer brought me on the right track. I was under the perhaps wrong impression that using the symbolic name had previously worked.)
Background Since I was switching to an own VM instance (instead of Google Cloud shell) for developing container images, I am receiving "Insufficient Permission"
errors from gcloud compute addressess list
on that VM instance. I understand that I could improve this by recreating the VM instance with scope https://www.googleapis.com/auth/compute.readonly
. In any case, this restriction apparently had nothing to do with the problem at hand.
Solution 3:
You should create regional address:
gcloud compute addresses create my-secure-sftp --region europe-west2
It allocates Global IP for ingress controller (status IN_USE), this is exactly what you need.
Global static and Internal static will not work in your case.