[英]Access GKE pods with Cloud functions using Google Serverless VPC
I have created a GKE private cluster, with some pods live in it.我创建了一个 GKE 私有集群,里面有一些 pod。 Now I want to integrate my pods with cloud function provided by GCP.
现在我想将我的 pod 与 GCP 提供的云 function 集成。 To achieve this, I use Serverless VPC access, because my GKE cluster lived on a custom.network on another region and use Internal Load Balancer for my pods.
为实现这一点,我使用无服务器 VPC 访问,因为我的 GKE 集群位于另一个区域的 custom.network 上,并为我的 pod 使用内部负载均衡器。
It seems successful, because I have tested to access my pods internal IP from GCE lived in the same.network and tested to access my GCE VM from Cloud Function, but when I try to access my pod internal IP from the Cloud Function, it always returns timeout.这似乎是成功的,因为我已经测试从 GCE 访问我的 pod 内部 IP 生活在 same.network 并测试从云 Function 访问我的 GCE VM,但是当我尝试从云 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
I expect the Serverless VPC access will connect my cloud function to my pod Internal IP, like it connects my cloud function to GCP VM with same.network with my pod.我希望无服务器 VPC 访问将我的云 function 连接到我的 pod 内部 IP,就像它将我的云 function 连接到具有与我的 pod 相同的网络的 GCP VM。
I know that the question was asked almost 3 years ago.我知道这个问题是大约 3 年前提出的。 May answer will be useful for somebody.
可能回答对某人有用。
We can make internal load balancer using LoadBalancer
type and annotation cloud.google.com/load-balancer-type: "Internal"
我们可以使用
LoadBalancer
类型和注释cloud.google.com/load-balancer-type: "Internal"
创建内部负载均衡器
Should be smth like this:应该是这样的:
apiVersion: v1
kind: Service
metadata:
name: service_name
annotations:
cloud.google.com/load-balancer-type: "Internal"
labels:
...
spec:
type: LoadBalancer
selector:
...
ports:
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.