You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Kubernetes Service (AKS) 1.20.7版本下如何以IPVS代理模式启动kube-proxy以实现最小连接数负载均衡

Hey there! Let's get your AKS 1.20.7 cluster set up with kube-proxy running in IPVS mode using the least connection (lc) scheduler. I've walked through this process a few times, so here's a straightforward, step-by-step guide:

Prerequisites
  • Make sure you have the Azure CLI installed and updated to version 2.18.0 or later—this is when the --kube-proxy-config parameter became available for configuring AKS kube-proxy settings. You can check your current version with az --version, and update it if needed using your OS's package manager or the official Azure install script.
  • Ensure you have contributor-level permissions to modify your AKS cluster (or the resource group it lives in).
Update your existing AKS cluster to use IPVS + LC scheduler

Since you already have a running cluster, we'll use the Azure CLI to update kube-proxy's configuration directly. This is the safest approach for managed AKS clusters (avoid manually editing the kube-proxy ConfigMap, as Azure might overwrite it during automated updates).

Run this command, replacing <your-resource-group-name> and <your-aks-cluster-name> with your actual values:

az aks update --resource-group <your-resource-group-name> --name <your-aks-cluster-name> --kube-proxy-config '{"mode": "ipvs", "ipvsScheduler": "lc"}'

Wait for the update to finish—this typically takes 5-10 minutes, depending on how many nodes are in your cluster. Azure will roll out the changes node-by-node, so your applications should stay available during the process.

Verify the configuration is working

Once the update completes, let's confirm everything is set up correctly:

  1. Check the kube-proxy ConfigMap
    Run this command to view the active kube-proxy configuration:

    kubectl get configmap kube-proxy -n kube-system -o yaml
    

    Look for the mode: ipvs and ipvsScheduler: lc entries under the config.conf section—this confirms the scheduler is set to prioritize least active connections.

  2. Validate kube-proxy pod startup parameters
    Check that the kube-proxy pods are using the correct flags on startup:

    kubectl logs -n kube-system -l k8s-app=kube-proxy | grep -E "(mode|ipvs-scheduler)"
    

    You should see lines like --mode=ipvs and --ipvs-scheduler=lc in the output, which means the pods are running with the right configuration.

  3. Inspect IPVS rules (optional deep dive)
    To see the actual IPVS load balancing rules in action, exec into one of the kube-proxy pods and run the ipvsadm tool:

    # First, get the name of a kube-proxy pod
    kubectl get pods -n kube-system -l k8s-app=kube-proxy
    # Then exec into it
    kubectl exec -n kube-system <kube-proxy-pod-name> -- ipvsadm -Ln
    

    Look for the Scheduler column in the output—each cluster service should show lc as its active scheduler.

Quick notes to remember
  • AKS 1.20.7 fully supports IPVS mode, so you won't run into version-specific issues here.
  • Keep in mind that this configures internal cluster service routing (via kube-proxy). If you need your external Azure Load Balancer to use least connections, that's a separate setting managed through Azure's LB configuration, but it sounds like your focus is on the kube-proxy level load balancing.

内容的提问来源于stack exchange,提问作者Farzad J

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 04:29:05