【发布时间】:2021-12-20 04:34:17
【问题描述】:
(已编辑) 我想将 GKE pod 连接到 Atlas。
我有一个 Atlas 数据库,其 VPC 对等连接设置到 GCP VPC 网络。我正在尝试应用我在这些 tuts 中学到的东西:
Configuring VPC Network Peering
Controlling Access to VPC Networks
当我在 GCP 控制台中查看 VPC 网络对等 > 路由 > 对等时,我看到了自动配置的对等路由。我不知道如何设置或如何测试连接。我从我的 pod ping atlas IP,它得到 100% 的数据包丢失,但是没有路由,所以它不应该通过。我从那里的 pod 转到 VM 实例和 SSH,然后运行
docker run --rm busybox ping 192.168.0.0 -c 3
但是,可以预见的是,结果是一样的。
从我做的 gcloud shell:
gcloud compute firewall-rules list
然后得到:
NAME: allow-monolith-nodeport
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 1000
ALLOW: tcp:31000
DENY:
DISABLED: False
NAME: default-allow-icmp
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 65534
ALLOW: icmp
DENY:
DISABLED: False
NAME: default-allow-internal
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 65534
ALLOW: tcp:0-65535,udp:0-65535,icmp
DENY:
DISABLED: False
NAME: default-allow-rdp
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 65534
ALLOW: tcp:3389
DENY:
DISABLED: False
NAME: default-allow-ssh
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 65534
ALLOW: tcp:22
DENY:
DISABLED: False
NAME: gke-my-cluster-94435ead-all
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 1000
ALLOW: icmp,esp,ah,sctp,tcp,udp
DENY:
DISABLED: False
NAME: gke-my-cluster-94435ead-ssh
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 1000
ALLOW: tcp:22
DENY:
DISABLED: False
NAME: gke-my-cluster-94435ead-vms
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 1000
ALLOW: icmp,tcp:1-65535,udp:1-65535
DENY:
DISABLED: False
NAME: k8s-fw-l7--ca9214afee2f865d
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 1000
ALLOW: tcp:30000-32767
DENY:
DISABLED: False
在 GKE 中,我创建了一个具有计算网络管理员角色的服务帐户,但不确定如何将其链接到我的 pod 的虚拟机?我需要这个来更改 pod 虚拟机的防火墙规则 - 如果我可以从 pod/服务清单中进行声明会更好。
在 Atlas 中,我将我的 pod 虚拟机的外部 IP 添加到网络访问 IP 访问列表中。
如何在 Mongodb Atlas 和 GKE pod 之间设置 VPC 网络对等互连,以便在我 ping Atlas CIDR 时收到数据包?
****** 编辑 *****
当我关注这个 tut atlas k8s peering tut 时,我发现我无法在 GKE 上更改我的 k8s 网络?我需要从头开始重新创建集群吗?
【问题讨论】:
-
是的! Atlas Network Access Network Peering 选项卡中也有相同的说明
标签: google-kubernetes-engine mongodb-atlas gke-networking gcp-peering