简体   繁体   English

GKE 与 Google Cloud 上的 Compute Engine 之间的专用连接

[英]Private connection between GKE and Compute Engine on Google Cloud

  • I have a compute engine instance with persistent file storage that I need outside of my GKE cluster.我有一个在 GKE 集群之外需要的具有持久文件存储的计算引擎实例。
  • I would like to open a specific TCP port on the Compute Engine instance so that only nodes within the GKE cluster can access it.我想在 Compute Engine 实例上打开一个特定的 TCP 端口,以便只有 GKE 集群中的节点可以访问它。
  • The Compute Engine instance and GKE cluster are in the same GCP project, network, and subnet. Compute Engine 实例和 GKE 集群位于同一个 GCP 项目、网络和子网中。
  • The GKE cluster is not private and I have an ingress exposing the only service I want exposed to the internet. GKE 集群不是私有的,我有一个入口,将我想要暴露给互联网的唯一服务公开。

I've tried creating firewall rules of three different types that do not work:我尝试创建三种不起作用的防火墙规则:

  • By shared service account on both Compute Engine instance and K8s nodes.通过 Compute Engine 实例和 K8s 节点上的共享服务帐户。
  • By network tags - (yes I am using the network tags as explicitly specified on the VM instance page).通过网络标签 - (是的,我正在使用虚拟机实例页面上明确指定的网络标签)。
  • By IP address, where I use network tag for target and private IANA IP ranges 10.0.0.0/8 , 172.16.0.0/12 , and 192.168.0.0/16 for source.通过 IP 地址,我使用网络标签作为目标和私有 IANA IP 范围10.0.0.0/8172.16.0.0/12192.168.0.0/16作为源。

The only thing that works is the last option but using 0.0.0.0/0 for source IP range.唯一有效的是最后一个选项,但使用0.0.0.0/0作为源 IP 范围。

I've looked at a few related questions such as:我查看了一些相关的问题,例如:

But I'm not looking to make my GKE cluster private and I have tried to create the firewall rules using network tags to no avail.但我不希望将我的 GKE 集群设为私有,我尝试使用网络标签创建防火墙规则但无济于事。

What am I missing or is this not possible?我错过了什么或者这是不可能的?

Not sure how I missed this, fairly certain I tried something similar a couple months back but must have had something else misconfigured.不知道我是怎么错过的,相当肯定我在几个月前尝试过类似的东西,但肯定有其他错误配置。

On the GKE cluster Details page, there is a pod address range.在 GKE 集群详情页面,有一个 pod 地址范围。 Setting the firewall source range to GKE pod address range gave me the the desired outcome.将防火墙源范围设置为 GKE pod 地址范围给了我想要的结果。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM