I have a situation where Kubernetes apparently can no longer assign an external IP address to a service upon kubectl create -f Deployment.yaml. kubectl describe service <my-service> reports the following error:
CreatingLoadBalancerFailed
Error creating load balancer (will retry): Failed to create load balancer
for service default/<my-service>: requested ip <my-address> is
neither static nor assigned to LB <id>(default/<my-service>): <nil>
But gcloud compute addresses list indicates that my-address is a static IP address:
NAME REGION ADDRESS STATUS
<my-address> europe-west1 <ip-address> RESERVED
And Deployment.yaml contains a spec for <my-service> that assigns <my-address> to a load balancer:
kind: Service
apiVersion: v1
metadata:
name: my-service
spec:
selector:
app: my-app
ports:
- protocol: UDP
port: <my-port>
type: LoadBalancer
loadBalancerIP: <my-address>
What is especially strange: the (almost) same deployment has worked before. I have already tried to recreate my cluster, but this also did not help. What else could be wrong and how can I overcome the error to make my service reachable from the outside again?
UPDATE I have reserved a new static (this time also global) IP address with gcloud compute addresses create test-address --global and changed the assignment to LB accordingly: loadBalancerIP: test-address. But the same error remains still.
UPDATE If I don't specify loadBalancerIP in Deployment.yaml, deployment succeeds without errors an a new external IP address is assigned to my-service. The service can be pinged from outside at this address.
UPDATE If I delete my former address with gcloud compute addresses delete my-address --region europe-west1, promote the new external address with gcloud compute addresses create --addresses <ip-address> --region europe-west1, and then redeploy with the original line loadBalancerIP: my-address restored in Deployment.yaml, the same error surfaces again.