如何解决Python Flask 应用程序的应用程序引擎灵活环境问题
我实际上对 App Engine 柔性环境部署感到恼火。我正在使用 Cloud Build 从 GitHub 存储库部署我的代码,但手动部署时也会出现此问题。
我想创建一个具有灵活环境的简单 Flask 应用程序来为 Web 应用程序“分析”部分加载 Tensorflow 模型(这不是更好的方法,GCP ML 存在,但我想使用 App引擎)。
这是我的 analysis.yaml
文件:
service: analysis
env: flex
runtime: custom
runtime_config:
python_version: 3
resources:
memory_gb: 2.4
(我也试过没有入口点)
在 Cloud Build 中部署我的服务时出现警告,如下所示:
WARNING: Unable to verify that the Appengine Flexible API is enabled for project [XXX]. You may not have permission to list enabled services on this project. If it is not enabled,this may cause problems in running your deployment. Please ask the project owner to ensure that the Appengine Flexible API has been enabled and that this account has permission to list enabled APIs.
在提出这个问题后,我关注了这篇文章:How can I grant the account permission to list enabled APIs?,以启用 App Engine API 并为我的服务帐户授予正确的角色。
使用 gcloud SDK 我启用并检查了带有 gcloud services enable appengineflex.googleapis.com
和 gcloud services list
的 App Engine 灵活 API
然后,我向 Cloud Build 服务帐户授予了以下角色:
以及用于我的 App Engine 服务帐户的那些:
我真的不明白为什么我的部署失败了。我想它是由错误的权限角色分配触发的,但我不知道。
我期待您的帮助并提前致谢。
解决方法
请注意,默认 App Engine 服务帐户不同于 App Engine Official Documentation
中所述的 App Engine 柔性环境服务帐户App Engine Flexible 使用成员 ID: service-[YOUR_PROJECT_NUMBER]@gae-api-prod.google.com.iam.gserviceaccount.com
请确认 App Engine 柔性环境服务帐户已被授予 App Engine 柔性环境服务代理角色。
The App Engine Flexible Service Agent Role 包含 Python 柔性环境管理柔性环境应用程序所需的一组权限。
另请记住,App Engine 柔性环境服务代理角色是保留用于App Engine 柔性环境服务帐户的。请勿将此 IAM 角色授予任何其他账户,因为该角色包含的权限可能会更改,恕不另行通知。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。