我认为公共访问是危险的,所以我想构建出口,只将出口ip添加到白名单。
**
1.由于GKE是公共的,所以不包括云NAT,它是私有的。
2.我从来没有用过TERRAFORM,所以我想要一个除了TERRAFORM之外的答案。
3.VPC和VPN也很难理解。
**这是目前设置的出口。
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: test-egress
spec:
podSelector:
matchLabels:
app: testapp
networking/allow-internet-egress: "true"
policyTypes:
- Egress
egress:
- to:
- ipBlock:
#static google ip
cidr: xx.xxx.xx.xxx/32再说一遍,我无法连接到数据库。谁来帮帮忙
发布于 2022-08-04 12:01:45
您可以跟踪并使用Terraform:https://registry.terraform.io/modules/GoogleCloudPlatform/nat-gateway/google/latest/examples/gke-nat-gateway
它将使用 IP为您创建公共NAT,您可以将白名单添加到RDS中。
您可以使用shell脚本,它将接受2-3个变量输入并自动调用Terraform。
不需要对Terraform进行任何更改,如果您没有使用TF的经验,您也可以使用Github中的Button直接在GCP云shell上运行。
https://stackoverflow.com/questions/73234355
复制相似问题