【问题标题】:Failed to export the service using GKE Multi-Cluster Service使用 GKE 多集群服务导出服务失败
【发布时间】:2021-12-12 13:21:47
【问题描述】:

我正在根据document1document2 配置GKE Multi-Cluster Service,并受到multi-cluster-serice-communication-in-gke tutorial 的启发。

不知何故,我在“Registering a Service for export”上失败了 在第二个集群上。

我正在使用以下 YAML 文件在第一个(舰队集群)上导出 ngnix 服务

# export.yaml
kind: ServiceExport
apiVersion: net.gke.io/v1
metadata:
 namespace: multy-service-poc
 name: ngnix-service

并且导出良好 - 可从另一个集群访问,并且 ServiceExport 在第一个集群上的状态为 True

k describe serviceexport ngnix-service                                                                             
Name:         ngnix-service
Namespace:    multy-service-poc
Labels:       <none>
Annotations:  <none>
API Version:  net.gke.io/v1
Kind:         ServiceExport
Metadata:
  Creation Timestamp:  2021-12-11T11:22:37Z
  Finalizers:
    serviceexport.net.gke.io
  Generation:  2
  Managed Fields:
    API Version:  net.gke.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
    Manager:      kubectl-client-side-apply
    Operation:    Update
    Time:         2021-12-11T11:22:37Z
    API Version:  net.gke.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:finalizers:
          .:
          v:"serviceexport.net.gke.io":
      f:spec:
      f:status:
        .:
        f:conditions:
    Manager:         Google-GKE-MCS
    Operation:       Update
    Time:            2021-12-11T11:22:39Z
  Resource Version:  58873
  UID:               a42dc51c-93ff-4526-9c04-9702ed7ba95d
Spec:
Status:
  Conditions:
    Last Transition Time:  2021-12-11T11:22:38Z
    Status:                True
    Type:                  Initialized
    Last Transition Time:  2021-12-11T11:22:40Z
    Status:                True
    Type:                  Exported
Events:                    <none>

当我使用相同的 YAML 文件在第二个集群上导出相同的服务时,它失败并且状态为 False

kubectl  describe serviceexport ngnix-service 
Name:         ngnix-service
Namespace:    multy-service-poc
Labels:       <none>
Annotations:  <none>
API Version:  net.gke.io/v1
Kind:         ServiceExport
Metadata:
  Creation Timestamp:  2021-12-13T07:29:36Z
  Finalizers:
    serviceexport.net.gke.io
  Generation:  2
  Managed Fields:
    API Version:  net.gke.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
    Manager:      kubectl-client-side-apply
    Operation:    Update
    Time:         2021-12-13T07:29:36Z
    API Version:  net.gke.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:finalizers:
          .:
          v:"serviceexport.net.gke.io":
      f:spec:
      f:status:
        .:
        f:conditions:
    Manager:         Google-GKE-MCS
    Operation:       Update
    Time:            2021-12-13T07:31:10Z
  Resource Version:  1191220
  UID:               45bb42a8-effc-4a9d-95e8-22ff736a54af
Spec:
Status:
  Conditions:
    Last Transition Time:  2021-12-13T07:30:03Z
    Status:                True
    Type:                  Initialized
    Last Transition Time:  2021-12-13T07:31:10Z
    Message:               Conflicting "Project". Using from oldest service export in cluster "projects/mssp-eugene-mcs1/locations/us-east1/clusters/mssp-eugene-mcs-k8s-cluster1"
    Reason:                Conflict
    Status:                False
    Type:                  Exported
Events:                    <none>

我也看到了中心成员中的集群:

gcloud container hub memberships list --project eugene-mcs1
NAME                          EXTERNAL_ID
eugene-mcs-k8s-cluster2  e943ed80-6a49-4781-897c-57ae3266fb37
eugene-mcs-k8s-cluster1  074d59f2-fce2-491e-a99e-6d2b8587803c

预期的行为是从两个集群导出 ngnix-service 并相应地从两个集群公开 ngnix pod。

我的配置是 使用来自第三个宿主项目的共享 VPC 的不同项目中的 2 个 K8S 集群。

谢谢

【问题讨论】:

  • 当您尝试在第二个集群中导出相同的服务并失败时,系统显示的消息是什么?能否请您分享错误消息的详细信息?
  • 没有错误,我只是看到流量导向器没有添加“网络端点组”,所以我检查了第二个集群描述上的serviceexport,发现冲突消息和状态。跨度>
  • 您是否按照google官方文档配置MCS?此外,请确保在两个集群中创建相同的命名空间。 cloud.google.com/kubernetes-engine/docs/how-to/…
  • Google Cloud 支持团队正在调查的问题。没有 ETA 的解决方案。

标签: google-kubernetes-engine kubernetes-service gke-networking


【解决方案1】:

实际上,GKE 多集群服务仅适用于同一宿主项目中的集群,即使文档告诉它它适用于不同项目中的集群。
这是谷歌云支持对我的票的官方回复:

我收到了来自 Google 产品工程团队的以下反馈:
... 由于有一个主机项目、一个队列服务项目 1 和一个服务项目 2,因此任何给定服务的后端都必须完全包含在单个项目中;换句话说,后端只能从单个项目中的集群聚合,尽管它们可以来自该服务项目 1 中的多个集群(这仍然允许容错,因为这些集群可以来自不同的区域,而不是跨越项目边界)。这些后端通过 VPC Shared MCS 服务(即 yourservice.yournamespace.svc.clusterset.local),只要存在命名空间(即 yournamespace),服务项目 2 就可以使用 MCS 访问服务项目 1 中的后端。

因此,您的目标服务、所有后备 pod(以及所有 ServiceExport)都应该在 VPC 服务项目 1 中的集群中。为了容错,VPC 服务项目 1 中应该有多个集群从不同区域导出此服务.该服务可能位于 VPC 服务项目 2 的集群中,作为 VPC 服务项目 1 的后端...

如上所述,遗憾的是,使用来自不同共享 VPC 服务项目(而不是不同区域的集群)的集群的 MCS 服务的高可用性目前是不可能的。这是因为 MCS 工作负载还无法解析具有不同项目 ID 的常见导出服务。我希望我的解释清楚,如果您有任何不明白的地方,请告诉我。

如果您愿意,我可以创建一个公共问题跟踪器来请求此功能,以便您可以关注有关此问题的任何更新。但是,如果有的话,我无法提供预计何时实施。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-06-11
    • 1970-01-01
    • 2013-03-08
    • 2016-02-22
    • 2017-03-16
    • 2017-08-22
    • 2021-05-20
    • 1970-01-01
    相关资源
    最近更新 更多