kubernetesgateway

Adding labels and annotations to gateway created loadbalacner


I am creating a gateway object and I want to add labels and annotations to the provided server.

---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
  name: obs-gateway
  namespace: default
  labels:
    advertise-bgp: 'true'
  annotations:
    "io.cilium/lb-ipam-ips": "10.253.5.33"
spec:
  gatewayClassName: cilium
  listeners:
    - protocol: HTTP
      hostname: "*.obs.painful.me"
      port: 80
      name: web-gw
      allowedRoutes:
        namespaces:
          from: All

Solution

  • Currently this is an experimental feature and the experimental crds need to be applied to use this

    GEP-1762 tracks this feature

    ...
    spec:
      infrastructure:
        labels:
          advertise-bgp: 'true'
        annotations:
          "io.cilium/lb-ipam-ips": "10.253.5.33"