In the ServiceSpec documentation, the loadBalancerIP attribute is deprecated. The documentation invites users of Kubernetes 1.24 to use implementation specific annotations. I was wondering what is the plan for Load Balancers when using GKE, since the documentation still only gives the option of using the loadBalancerIP attribute (Ref: https://cloud.google.com/kubernetes-engine/docs/concepts/service-load-balancer-parameters#spd-static-ip).
Here is the discussion on the k8s github about what's going to happen to that field [1]
My understanding from reading the conversation and the documentation you pointed out is that there is a consensus that the field needs to go away because it doesn't support dual-stack. But for now and until cloud providers have an alternative (via annotation) to setting a static LB IP. That field will remain and will continue to work.
We (GCP) don't have that alternative yet. So for now you continue using that field until we have it implemented. In any case it will be mentioned in the GKE release notes
GKE (Google Kubernetes Engine) introduced the annotation networking.gke.io/load-balancer-ip-addresses
to replace and take precedence over spec.loadBalancerIP
. It was introduced with version 1.29 of GKE and allows both IPv4 and IPv6 addresses to be specified for internal and external LoadBalancer services. [1]
apiVersion: v1
kind: Service
metadata:
annotations:
cloud.google.com/l4-rbs: enabled
networking.gke.io/load-balancer-ip-addresses: <ip-address-resource-name>
...
spec:
type: LoadBalancer
...
Please note that the annotation requires the IP address resource name to be supplied, not the IP address itself. Furthermore, external LoadBalancer services require cloud.google.com/l4-rbs: enabled
to be set as well.
© 2022 - 2025 — McMap. All rights reserved.