kubernetes on google failed to create load balancer ip static
Asked Answered
S

3

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>
Scandian answered 20/3, 2017 at 1:18 Comment(0)
S
16

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

Scandian answered 20/3, 2017 at 10:13 Comment(3)
Is this behavior and reasons documented somewhere?Bevy
Were you able to figure out how to get it to work with global IPs? I'm running into the same error...Bloomy
Turns out Google indeed only supports regional static ip addresses for network LBs (NLBS) as described here cloud.google.com/kubernetes-engine/docs/tutorials/…Bloomy
J
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.

Jemima answered 10/7, 2019 at 5:53 Comment(0)
V
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

Vladimar answered 22/7, 2020 at 15:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.