在 Google Kubernetes Engine 上创建多集群入口时,是什么阻止设置 'instance-groups' 注释?

What prevents the 'instance-groups' annotation from being set when creating a multi-cluster ingress on Google Kubernetes Engine?

我正在尝试使用 kubemci 在 Google Kubernetes Engine 上创建多集群入口,但是当 运行 以下命令时,程序会无限期地等待入口服务获取 ingress.gcp.kubernetes.io/instance-groups 注释(如下面的输出所示)。

是什么阻止设置此注释?

输入

./kubemci create app-mci \
    --ingress=ingress.yaml \
    --gcp-project=app-prod \
    --kubeconfig=mcikubeconfig

输出

% ./kubemci create app-mci --ingress=ingress.yaml --gcp-project=app-prod --kubeconfig=clusters.yaml        
Created Ingress in cluster: gke_app-prod_europe-west4-a_app-europe-west4
Created Ingress in cluster: gke_app-prod_us-east4-a_app-us-east4
Ensuring health checks
Pod app-deployment-c99578769-xdmql matching service selectors app=app (targetport ): lacks a matching HTTP probe for use in health checks.
Pod app-deployment-c99578769-xgq2m matching service selectors app=app (targetport ): lacks a matching HTTP probe for use in health checks.
Pod app-deployment-c99578769-qms7r matching service selectors app=app (targetport ): lacks a matching HTTP probe for use in health checks.
Pod app-deployment-c99578769-tsrsw matching service selectors app=app (targetport ): lacks a matching HTTP probe for use in health checks.
Path for healthcheck is /
Ensuring health check for port: {SvcName:default/app-service SvcPort:{Type:0 IntVal:80 StrVal:} NodePort:30061 Protocol:HTTP SvcTargetPort: NEGEnabled:false}
Health check mci1-hc-30061--app-mci exists already. Checking if it matches our desired health check
Desired health check exists already
Determining instance groups for cluster gke_app-prod_europe-west4-a_app-europe-west4
Waiting for ingress ( default : app-ingress ) to get ingress.gcp.kubernetes.io/instance-groups annotation.....
Waiting for ingress ( default : app-ingress ) to get ingress.gcp.kubernetes.io/instance-groups annotation.....
Waiting for ingress ( default : app-ingress ) to get ingress.gcp.kubernetes.io/instance-groups annotation.....
⋮

如您所见,我的配置与 multi-cluster ingress guide:

中的相同(资源名称除外)

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: app-deployment
spec:
  selector:
    matchLabels:
      app: app
  replicas: 2
  template:
    metadata:
      labels:
        app: app
    spec:
      containers:
        - name: app
          image: gcr.io/app-prod/app:tag
          ports:
            - containerPort: 8080

service.yaml

apiVersion: v1
kind: Service
metadata:
  labels:
    app: app
  name: app-service
spec:
  ports:
    - port: 80
      protocol: TCP
      targetPort: 8080
      name: http
      nodePort: 30061
  selector:
    app: app
  type: NodePort

ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: app-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: app-ip
    kubernetes.io/ingress.class: gce-multi-cluster
spec:
  backend:
    serviceName: app-service
    servicePort: 80

启用 HTTP 负载平衡

启用 HTTP 负载平衡插件以允许 load balancer controller 设置 ingress.gcp.kubernetes.io/instance-groups 注释。

控制台

  1. 编辑集群。
  2. 展开插件
  3. 启用 HTTP 负载平衡:

命令行

% gcloud container clusters update [CLUSTER_NAME] --update-addons HttpLoadBalancing=ENABLED

Updating ***...done.                                                                                                                                                              
Updated [https://container.googleapis.com/v1/projects/***/zones/us-east4-a/clusters/***].
To inspect the contents of your cluster, go to: https://console.cloud.google.com/kubernetes/workload_/gcloud/us-east4-a/***?project=***

查看集群配置:

% gcloud container clusters describe [CLUSTER_NAME]

# ENABLED
addonsConfig:
  httpLoadBalancing: {}

# DISABLED
addonsConfig:
  httpLoadBalancing:
    disabled: true


配置服务

确保多集群入口中使用的后端服务配置正确。

服务必须:

  • Have the same name in all of the clusters.
  • Be in the same namespace in all of the clusters.
  • Be of type NodePort.
  • Use the same port number for all of the clusters.

    Setting up a multi-cluster Ingress, Google


信用

  • Nikhil Jindal 的洞察力。
  • Ivan 养 this issue.