Search code examples
kubernetesazure-aks

AKS seems to ignore Kubernetes load balancer annotations


I need to switch off some probes on LB for LoadBalancer type services. As this is not possible I fall back to trying to set long probe interval. This can be done by annotations defined on this documentation page.

But I am not able to update the health probe values, the annotations are not working. I verified that it works for setting internal LB, but I am not able to influence the probes by annotation. Is there any other requirement other then having kubernetes version higher than 1.21?

UPDATE

apiVersion: v1
kind: Namespace
metadata:
  name: echoserver
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: echoserver
  namespace: echoserver
  labels:
    app: echoserver
spec:
  replicas: 3
  selector:
    matchLabels:
      app: echoserver
  template:
    metadata:
      labels:
        app: echoserver
    spec:
        containers:
        - name: echoserver
          image: mbodenhamer/echoserver:latest
          env:
          - name: LISTEN_PORTS
            value: "5000,5001,5002"
          ports:
          - containerPort: 5000
          - containerPort: 5001
          - containerPort: 5002
---
apiVersion: v1
kind: Service
metadata:
  name: echoserver
  namespace: echoserver
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"
    service.beta.kubernetes.io/port_5000_health-probe_interval: "13"
    service.beta.kubernetes.io/port_5001_health-probe_interval: "14"
    service.beta.kubernetes.io/port_5002_health-probe_interval: "15"
spec:
  type: LoadBalancer
  ports:
  - port: 5000
    targetPort: 5000
    protocol: TCP
    name: port5000
  - port: 5001
    targetPort: 5001
    protocol: TCP
    name: port5001
  - port: 5002
    targetPort: 5002
    protocol: TCP
    name: port5002
  selector:
    app: echoserver

Solution

  • The reason for the annotations not being picked up is describe here. Either you need to enable Cloud controller or rise version of AKS to 1.22