【问题标题】:Unable to assign public ip address to AKS: pending forever无法将公共 IP 地址分配给 AKS:永远挂起
【发布时间】:2019-06-25 16:41:43
【问题描述】:

我为我的资源组分配了一个 IP 地址,如下所示:

az network public-ip create --resource-group myResourceGroup --name ipName --allocation-method static

现在,我想将它分配给我的 AKS,所以我只是更改了 yaml,如下所示:

 apiVersion: v1
 kind: Service
 metadata:
 name: nginx
 spec:
   loadBalancerIP: xx.xx.xxx.xxx <--the ip generated before
   type: LoadBalancer
   ports:
   - port: 80
   selector:
    app: nginx-sgr

然后我运行:

kubectl apply -f mykube.yaml

但它似乎卡住了:

NAME        TYPE           CLUSTER-IP    EXTERNAL-IP   PORT(S)        AGE
nginx   LoadBalancer      10.0.77.234   <pending>     80:32320/TCP   79m

通过执行 describe 我确实得到了以下信息:

Warning  CreatingLoadBalancerFailed  21m (x19 over 86m)  service-controller  Error creating 
load balancer (will retry): failed to ensure 
  load balancer for service default/nginx: user supplied IP Address 
  xx.xx.xxx.xxx was not found in resource group 
  MC_**myResourceGroup**_myAKSCluster_westeurope

请注意,它似乎在由我在第一个命令中指定的资源组(与 kubernates 相同)和其他信息组成的资源组中搜索...我做错了什么?

【问题讨论】:

  • 能否通过命令kubectl describe service nginx提供更多关于服务状态的详细信息?
  • 更新了!我想我现在知道原因,但我不知道如何解决它......

标签: azure azure-aks


【解决方案1】:

据我所知,可能的原因是如果您在另一个组中创建公共 IP,则需要为您的 AKS 分配您创建公共 IP 的资源组的权限。有关详细信息,请参阅Use a static IP address outside of the node resource group。您需要添加如下注释:

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-resource-group: myResourceGroup
  name: azure-load-balancer
spec:
  loadBalancerIP: 40.121.183.52
  type: LoadBalancer
  ports:
  - port: 80
  selector:
    app: azure-load-balancer

或者,您可以在 AKS 群集节点组中创建公共 IP。对您来说,组名可以在您提供的错误中找到:MC_**myResourceGroup**_myAKSCluster_westeurope

【讨论】:

  • 我虽然是这样,但它是在同一个组中创建的
  • @Phate 不是你创建AKS的组,需要通过命令az aks show --resource-group myResourceGroup --name myAKSCluster --query nodeResourceGroup -o tsv获取节点组。这是与节点相同的组。
  • 您能说得更具体些吗?我认为资源组与节点组相同
  • @Phate 创建 AKS 时,有两个组。一个是AKS集群,另一个是AKS集群节点。看看this
  • @Phate 如何获得 AKS 主体 ID?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-07-29
  • 1970-01-01
  • 2011-11-03
  • 1970-01-01
  • 2023-03-29
  • 2021-12-22
  • 1970-01-01
相关资源
最近更新 更多