Denis Voloshin
Denis Voloshin

Reputation: 798

Kubernetes load balancer distribution mode on Azure

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://learn.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

Upvotes: 1

Views: 1976

Answers (1)

Sean McKenna
Sean McKenna

Reputation: 3714

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.

Upvotes: 1

Related Questions