What is the replacement for the deprecated loadBalancerIP attribute in Services
Asked Answered
T

2

6

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).

Tuxedo answered 16/9, 2022 at 22:6 Comment(0)
J
8

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

[1] https://github.com/kubernetes/enhancements/pull/1992

John answered 22/9, 2022 at 9:48 Comment(1)
Is any alternative yet?Anastigmat
H
1

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.

[1] https://cloud.google.com/kubernetes-engine/docs/concepts/service-load-balancer-parameters#spd-static-ip-parameters

Householder answered 2/8, 2024 at 12:2 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.