【发布时间】:2021-07-25 19:15:09
【问题描述】:
我们在为单个项目配置 VPC Service Controls 下的两个 GCP 组件(GCP Cloud Composer、GCP Functions)时遇到问题。我们可以使用 VPC Service Controls 单独配置它们,但是一旦添加第二个组件,我们就会遇到麻烦。
一旦我们为 Cloud Function 配置了防火墙规则和 DNS 设置,Composer 就会开始失败。 Composer 监控工具(用于 webserver、SQL server 等)显示 composer 不健康。
我们做错了什么?
我们使用过的文档:
https://cloud.google.com/functions/docs/securing/using-vpc-service-controls
https://cloud.google.com/composer/docs/configuring-vpc-sc
对于 Composer,我们使用以下设置:
- 3 个节点
- 标准机器类型
- 镜像版本:composer-1.16.3-airflow-1.10.15
- python: v3
- 私有 IP 编写器
我们为 VPC Service Controls 启用的 API:
- Google Cloud Dataproc API
- 云函数 API
- 谷歌云发布/订阅 API
- 云 SQL API
- 谷歌云存储 API
- 谷歌计算引擎 API
- Google Kubernetes 引擎 API
- Google 容器注册表 API
- 云监控 API
- Cloud Composer API
- 工件注册表 API
防火墙设置(基于文档):
| Name | Type | Targets | Filters | Protocols / Ports | Action | Priority |
|---|---|---|---|---|---|---|
| composer-egress-gke-cluster-all-port | Egress | Apply to all | IP ranges: 10.10.0.0/16 | tcp, udp | Allow | 1000 |
| composer-egress-healthcheck | Egress | Apply to all | IP ranges: 130.211.0.0/22, 35.191.0.0/16 | tcp:80,443 | Allow | 1000 |
| composer-egress-port53 | Egress | Apply to all | IP ranges: 0.0.0.0/0 | tcp:53, udp:53 | Allow | 1000 |
| composer-egress-webserver | Egress | Apply to all | IP ranges: 172.31.251.0/24 | tcp:3306,3307 | Allow | 1000 |
| restricted-google-apis | Egress | Apply to all | IP ranges: 199.36.153.4/30 | tcp:443 | Allow | 1000 |
| composer-deny-all | Egress | Apply to all | IP ranges: 0.0.0.0/0 | all | Deny | 2000 |
| composer-ingress-helthcheck | Ingress | Apply to all | IP ranges: 130.211.0.0/22, 35.191.0.0/16 | tcp:80,443 | Allow | 1000 |
| ingress-iap | Ingress | Apply to all | IP ranges: 35.235.240.0/20 | tcp | Allow | 1000 |
| gke-europe-west1-composer-dns-xxx-xxx-all | Ingress | gke-europe-west1-composer-dns-xxx-xxx-node | IP ranges: 10.124.0.0/14 | tcp;udp;esp;ah;sctp;icmp | Allow | 1000 |
| gke-europe-west1-composer-dns-xxx-xxx-master | Ingress | gke-europe-west1-composer-dns-xxx-xxx-node | IP ranges: 172.16.8.0/28 | tcp:10250,443 | Allow | 1000 |
| gke-europe-west1-composer-dns-xxx-xxx-vms | Ingress | gke-europe-west1-composer-dns-xxx-xxx-node | IP ranges: 10.10.0.0/16 | tcp:1-65535;udp:1-65535;icmp | Allow | 1000 |
DNS 设置(基于文档):
DNS 名称:googleapis.com。 类型:私人
| DNS name | Type | TTl(Seconds) | Data |
|---|---|---|---|
| *.googleapis.com. | CNAME | 300 | restricted.googleapis.com. |
| googleapis.com. | SOA | 21600 | ns-gcp-private.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300 |
| googleapis.com. | NS | 21600 | ns-gcp-private.googledomains.com. |
DNS 名称:cloudfunctions.net。 类型:私人
| DNS name | Type | TTl(Seconds) | Data |
|---|---|---|---|
| *.cloudfunctions.net. | A | 300 | 199.36.153.4,199.36.153.5,199.36.153.6,199.36.153.7 |
| cloudfunctions.net | NS | 21600 | ns-gcp-private.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300 |
| cloudfunctions.net. | SOA | 21600 | ns-gcp-private.googledomains.com. |
DNS 名称:pkg.dev。 类型:私人
| DNS name | Type | TTl(Seconds) | Data |
|---|---|---|---|
| *.pkg.dev. | CNAME | 300 | pkg.dev. |
| pkg.dev. | SOA | 21600 | ns-gcp-private.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300 |
| pkg.dev. | NS | 21600 | ns-gcp-private.googledomains.com. |
| pkg.dev. | A | 300 | 199.36.153.4,199.36.153.5,199.36.153.6,199.36.153.7 |
DNS 名称:gcr.io。 类型:私人
| DNS name | Type | TTl(Seconds) | Data |
|---|---|---|---|
| *.gcr.io. | CNAME | 300 | gcr.io. |
| gcr.io. | SOA | 21600 | ns-gcp-private.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300 |
| gcr.io. | NS | 21600 | ns-gcp-private.googledomains.com. |
| gcr.io. | A | 300 | 199.36.153.4,199.36.153.5,199.36.153.6,199.36.153.7 |
感谢您的任何想法或帮助。
【问题讨论】:
-
您能否提供一些您收到的日志或实际错误消息?从你的描述很难说是什么导致了这里的问题。
-
这个问题是很难获取相关日志... Composer在设置防火墙规则和DNS设置后根据它的监控UI开始失败。这个 UI 似乎以不一致的方式总结了结果。更改时间分辨率后,有时显示失败,有时一切都是绿色的。在 Composer 的子网上启用日志记录后,StackDriver 被太多记录转储以正确调试它。同时我们也发现了问题所在,我将在下面描述它。
标签: google-cloud-platform google-cloud-functions google-cloud-composer google-cloud-dns google-vpc