带有Azure Kubernetes服务的Azure内部负载均衡器不起作用

时间:2018-07-12 21:28:12

标签: azure kubernetes azure-kubernetes

我正在尝试使用以下链接连接到内部负载均衡器: https://docs.microsoft.com/en-us/azure/aks/internal-lb

我在收到的错误消息中看到一个不存在的用户:

Warning  CreatingLoadBalancerFailed  3m (x7 over 9m)  service-controller  Error creating load balancer (will retry): failed to ensure load balancer for service default/azure-vote-front: network.SubnetsClient#Get: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403 Code="AuthorizationFailed" Message="The client '91c18461-XXXXXXXX---1441d7bcea67' with object id '91c18461-XXXXXXXXX-1441d7bcea67' does not have authorization to perform action 'Microsoft.Network/virtualNetworks/subnets/read' over scope '/subscriptions/996b68c3-ec32-46d4-8d0e-80c6da2c1a3b/resourceGroups/<<resource group>>/providers/Microsoft.Network/virtualNetworks/<<VNET>>/subnets/<<subnet id>>

当我在Azure订阅中搜索该用户时,找不到该用户。 任何帮助都将受到高度赞赏

下面是我的清单文件

apiVersion: apps/v1beta1
    kind: Deployment
    metadata:
      name: azure-vote-back
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            app: azure-vote-back
        spec:
          containers:
          - name: azure-vote-back
            image: redis
            ports:
            - containerPort: 6379
              name: redis
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: azure-vote-back
    spec:
      ports:
      - port: 6379
      selector:
        app: azure-vote-back
    ---
    apiVersion: apps/v1beta1
    kind: Deployment
    metadata:
      name: azure-vote-front
    spec:
      replicas: 1
      strategy:
        rollingUpdate:
          maxSurge: 1
          maxUnavailable: 1
      minReadySeconds: 5 
      template:
        metadata:
          labels:
            app: azure-vote-front
        spec:
          containers:
          - name: azure-vote-front
            image: phishbotstagingregistry.azurecr.io/azure-vote-front:v1
            ports:
            - containerPort: 80
            resources:
              requests:
                cpu: 250m
              limits:
                cpu: 500m
            env:
            - name: REDIS
              value: "azure-vote-back"
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: azure-vote-front
      annotations:
        service.beta.kubernetes.io/azure-load-balancer-internal: "true"
    spec:
      type: LoadBalancer
      ports:
      - port: 80
      selector:
        app: azure-vote-front

1 个答案:

答案 0 :(得分:1)

创建AKS时,您提供了错误的凭据(或稍后删除了权限)。因此,服务主体AKS无权创建该资源(错误明确指出了这一点)。

  

Code =“ AuthorizationFailed”消息=“客户端   具有对象ID的'91c18461-XXXXXXXX --- 1441d7bcea67'   '91c18461-XXXXXXXXX-1441d7bcea67'没有授权   执行操作“ Microsoft.Network/virtualNetworks/子网/读取”   范围   '/ subscriptions / 996b68c3-ec32-46d4-8d0e-80c6da2c1a3b / resourceGroups / <> / providers / Microsoft.Network / virtualNetworks / <> / subnets / <>

您可以使用az aks list --resource-group <your-resource-group>来找到您的服务主体,但是错误提示却可以解决这个问题。