大网数据广告活动
服务器运维问答

How does Azure Loadbalancer work with Azure AKS

· 52CE 我爱测

I recently tried to figure out how an Azure Loadbalancer in front of an Azure AKS cluster actually routes traffic to the cluster nodes. Our (quite basic) setup: AKS cluster version 1.23.x with the default Azure Loadbalancer in fr…

问题原文

原帖链接 · antaxify · CC BY-SA 4.0

I recently tried to figure out how an Azure Loadbalancer in front of an Azure AKS cluster actually routes traffic to the cluster nodes.

Our (quite basic) setup:

  • AKS cluster version 1.23.x with the default Azure Loadbalancer in front of it
  • Traefik Ingress controller deployed with service type Loadbalancer

Maybe someone can answer me the following questions:

  1. The Ingress backend pool contains ALL cluster nodes, not just the ones where the ingress pods are running (also they only show the pod's private IP). If I understand the docs (https://docs.microsoft.com/en-us/azure/aks/concepts-network#services) correctly, the loadbalancer distributes traffic between ALL cluster nodes, and from there, it is forwarded to the nodes which actually run the Ingress controller pods. Potentially, this adds unnessesary hops and wastes bandwidth due to the forwarding. Is my understanding here correct?

  2. I have troubles to understand how traffic is forwarded from the loadbalancer to the cluster nodes. The backend pool contains entries with the nodes private IPs (no k8s service IPs or pod IPs), and the loadbalancing rule shows port 443 as source and destination port. However, there is no process listening on port 443 on any of the cluster nodes. Can someone explain to me (or point me to the docs I failed to find) that explain how this works?

已采纳解答

原帖链接 · mdaniel · CC BY-SA 4.0

Potentially, this adds unnessesary hops and wastes bandwidth due to the forwarding. Is my understanding here correct?

That's one way to look at it, the other way is that if the load balancer were only pointed at the Nodes containing "currently Ready" pods, it would need to be updated when one of them goes un-Ready, or that Node dies for any reason. It has never been my experience that cloud changes happen quickly, where as for most private networking setups, intra-cluster traffic is basically free

Can someone explain to me (or point me to the docs I failed to find) that explain how this works?

I can't speak to any of the Azure terms you used, but the underlying mechanism kubernetes uses is a NodePort through which it picks a (mostly random, although you can pick one if you have a strong opinion about it) free port on all the Nodes and then points the LoadBalancer's traffic at that port, which internal to the cluster arrives on the matching traffic port of the Service and

You are actually welcome to do that process "manually" if you had some specific reason for it (such as using an unsupported cloud provider that does not understand provisioning the fronting LoadBalancer) since aside from keeping all Nodes who are reporting Ready assigned to the LoadBalancer, there's no further in-cluster changes from the point the NodePort is assigned

small asterisk: I just learned that as of 1.24, the NodePort assignment can be disabled, and I'd presume that's a concession to the VPC CSI provider used by AWS, which enjoys provisioning actual ENIs in your VPC for each Pod address, so I guess they can skip the network hop in those cases, but (in general) that NodePort fronted by LoadBalancers is a good mental model to have and is also likely going to apply to easily 99% of the clusters in the wild

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-08-13)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。