是否可以为 App Engine Flex 分配静态外部 IP?

Is it possible to assign a static external IP to App Engine Flex?

Google 有 setting up an external IP for App Engine Standard 的文档。但是,我需要为 App Engine Flex 设置外部 IP。

我已按照教程成功创建了一个子网,其中包含连接到外部静态 IP 的 Cloud Router 和 Cloud NAT。我通过在其中创建一个 VM 实例来测试该设置是否有效,并发现所有出口流量确实来自保留的外部静态 IP。

但是,当我将 App Engine Flex 应用程序部署到该子网时,其请求并未通过保留的静态 IP 进行路由,而是似乎在使用 Google 提供的共享 IP 地址池。一切正常,没有部署错误,只是没有使用保留的外部 IP。该应用已分配到 app.yaml 中的子网:

network:
  name: default
  subnetwork_name: app-engine-subnet

关于让这个 Flex 实例通过保留的外部 IP 路由其出口流量的任何提示?我知道这可以使用 VM 实例作为代理来完成,但我更喜欢使用 Cloud NAT。

根据 Google Cloud NAT documentation, Cloud NAT cannot be used with VMs that have an external IP address. App Engine Flex does not support VMs with internal IPs only (Google App Engine documentation),因此 NAT 将不起作用。