已创建多个出口 public IP,但只使用了一个

Multiple egress public IP created, but only one used

我正在使用 AKS 针对外部应用程序并行执行多个负载测试代理。这些代理 pods 没有关联的服务。集群没有 Ingress 控制器。

我希望目标应用程序从多个 IP 命中,所以我用 Terraform 这样创建了 AKS 集群:

resource "azurerm_kubernetes_cluster" "cluster" {
  ...
  ...
  ...
  network_plugin = "azure"
  network_profile {
    load_balancer_profile {
      managed_outbound_ip_count = 3
    }
  }
}

使用该配置,我确实有 3 个 public IP 关联到集群出站负载均衡器,但只有一个 public IP 出现在目标应用程序访问日志中。

有没有办法强制使用所有可用的出口 public IP?

如果您没有部署服务,那么您使用的 LB 不是作为 Kubernetes 负载均衡器,而只是作为 SNAT 代理。
可能在这种情况下,LB 默认使用其主 IP 进行 SNAT 规则。

AKS 文档在谈论出站池功能时明确提到服务。

Deploy the public service <...>. The Azure Load Balancer will be configured with a new public IP that will front this new service. Since the Azure Load Balancer can have multiple Frontend IPs, each new service deployed will get a new dedicated frontend IP to be uniquely accessed.
https://docs.microsoft.com/en-us/azure/aks/load-balancer-standard#use-the-public-standard-load-balancer

尝试按照文档中的建议创建服务(每个外部 ip 一个)。