10

Although I reserved a static IP I got the following warning, while not having load balancer created :

> kubectl describe svc --namespace=api-1dt-dc
  FirstSeen LastSeen    Count   From            SubObjectPath   Type        Reason              Message
  --------- --------    -----   ----            -------------   --------    ------              -------
  48m       2m      15  {service-controller }           Normal      CreatingLoadBalancer        Creating load balancer
  48m       2m      15  {service-controller }           Warning     CreatingLoadBalancerFailed  Error creating load balancer (will retry): Failed to create load balancer for service api-1dt-dc/review-k8s-4yl6zk: requested ip 35.186.202.220 is neither static nor assigned to LB ad3c982840d0311e7b45942010a84004(api-1dt-dc/review-k8s-4yl6zk): <nil>
Thomas Parquier
  • 261
  • 1
  • 10

3 Answers3

16

OK, it seems to work only with regional IPs...

Thomas Parquier
  • 261
  • 1
  • 10
  • Is this behavior and reasons documented somewhere? – Boas Enkler Jun 25 '18 at 12:40
  • Were you able to figure out how to get it to work with global IPs? I'm running into the same error... – Bernie Lenz Jul 24 '19 at 19:07
  • Turns out Google indeed only supports regional static ip addresses for network LBs (NLBS) as described here https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip – Bernie Lenz Jul 24 '19 at 21:47
1

Hitting same issue while trying to expose with LoadBalancer.

  Normal   EnsuredLoadBalancer         2m (x2 over 1h)  service-controller  Ensured load balancer
  Warning  CreatingLoadBalancerFailed  2m (x2 over 1h)  service-controller  Error creating load balancer (will retry): not persisting update to service 'default/cb-gke-demo-ui' that has been changed since we received it: Operation cannot be fulfilled on services "cb-gke-demo-ui": the object has been modified; please apply your changes to the latest version and try again

Not sure how to fix it? GKE k8s cluster is deployed across AZz.

ram dhakne
  • 926
  • 7
  • 3
1

As Thomas Parquier said higher, it can be related to the fact that is not a regional ip.

Taking this service as an example:

apiVersion: v1
kind: Service
metadata:
  name: my-service-name
  annotations:
spec:
  selector:
    app: deployment-name
  clusterIP: 10.0.5.890
  externalTrafficPolicy: Cluster
  ports:
    - name: https
      port: 443
      protocol: TCP
      targetPort: 443
  sessionAffinity: None
  type: LoadBalancer
  loadBalancerIP: "72.229.?.?"

First delete your service

kubectl delete svc my-service-name;

Remove loadBalancerIP line (last one) from your Service and apply fixes:

kubectl apply -f my-service-name.yaml

Then, wait that an EXTERNAL_IP ip address has been assigned to your service

kubectl get svc;

Mark this address as static in google console https://console.cloud.google.com/networking/addresses/list

And finally, assign newly ip address to loadBalancerIP line in your Service

lionelto
  • 81
  • 5