Kubernetes load balancer distribution mode on Azure

6/19/2018

I'm trying to create a load balancer for azure Kubernetes deployment, I'm using the following yaml file

apiVersion: v1
kind: Service
metadata:
  name: test-api-lb
spec:
  type: LoadBalancer
  loadBalancerIP : XXX.XXX.XXX.XXX
  ports:
  - port: 8080
  selector:
    app: test-api 

and run it with

kubectl apply -f

What I need is to create a balancer with source IP affinity. I found the following stuff https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-distribution-mode how to configure it on Azure and modes the LB supports. There is LoadBalancerDistribution attribute which specifies the mode type. Unfortunately, I didn't find any documentation how it could be done for Kubernetes deployment.

Thanks in advance

-- Denis Voloshin
azure
azure-kubernetes
azure-load-balancer

1 Answer

6/22/2018

Rather than creating session affinity from the Azure LB to a specific node, you should configure it on the Kubernetes service by setting sessionAffinity to ClientIP as described here.

-- Sean McKenna
Source: StackOverflow