【问题标题】:Access GKE pods with Cloud functions using Google Serverless VPC使用 Google Serverless VPC 访问具有云功能的 GKE pod
【发布时间】:2019-05-17 05:17:14
【问题描述】:

我创建了一个 GKE 私有集群,其中有一些 pod。现在我想将我的 Pod 与 GCP 提供的云功能集成。为此,我使用无服务器 VPC 访问,因为我的 GKE 集群位于另一个区域的自定义网络上,并为我的 Pod 使用内部负载均衡器。

这似乎是成功的,因为我已经测试了从 GCE 访问我的 Pod 内部 IP 住在同一个网络中,并测试了从 Cloud Function 访问我的 GCE VM,但是当我尝试从 Cloud Function 访问我的 Pod 内部 IP 时,它总是返回超时。

The HTTP request failed with error %s
Get http://172.16.0.42: dial tcp 172.16.0.42:80: i/o timeout

我希望无服务器 VPC 访问将我的云功能连接到我的 pod 内部 IP,就像它将我的云功能连接到与我的 pod 具有相同网络的 GCP VM。

【问题讨论】:

    标签: kubernetes google-cloud-platform google-cloud-functions google-kubernetes-engine


    【解决方案1】:

    我知道这个问题是在大约 3 年前提出的。可能的答案对某人有用。

    我们可以使用LoadBalancer类型和注解cloud.google.com/load-balancer-type: "Internal"来制作内部负载均衡器

    应该是这样的:

    apiVersion: v1
    kind: Service
    metadata:
      name: service_name
      annotations:
        cloud.google.com/load-balancer-type: "Internal"
      labels:
    ...
    spec:
      type: LoadBalancer
      selector:
    ...
      ports:
    ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-23
      • 2018-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多