快速入门:将示例工作器池部署到 Cloud Run
本页面介绍了如何部署示例工作器池容器。部署后,工作器池会持续写入日志消息。
准备工作
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
如果您要使用现有项目来完成本指南,请验证您是否拥有完成本指南所需的权限。如果您创建了新项目,则您已拥有所需的权限。
-
Verify that billing is enabled for your Google Cloud project.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
如果您要使用现有项目来完成本指南,请验证您是否拥有完成本指南所需的权限。如果您创建了新项目,则您已拥有所需的权限。
-
Verify that billing is enabled for your Google Cloud project.
- 查看 Cloud Run 价格或使用价格计算器估算费用。
-
工作器池的 Cloud Run Developer (
roles/run.developer) 角色 -
服务身份的 Service Account User (
roles/iam.serviceAccountUser) 角色 -
项目的 Logs Viewer (
roles/logging.viewer) 角色 在 Google Cloud 控制台中,前往 Cloud Run:
从菜单中选择工作器池,然后点击部署容器以显示创建工作器池表单。
点击使用示例容器进行测试。
点击创建以将映像部署到 Cloud Run,然后等待部署完成。
点击日志标签页以查看工作器池写入的日志。工作器池会持续写入日志消息
Cloud Run Worker Pool instance is running!。在 Google Cloud 控制台中,前往 Cloud Run:
从菜单中选择工作器池,然后选择要删除的工作器池。
点击删除。
- In the Google Cloud console, go to the Manage resources page.
- In the project list, select the project that you want to delete, and then click Delete.
- In the dialog, type the project ID, and then click Shut down to delete the project.
所需的角色
如需获得完成本教程所需的权限,请让您的管理员为您授予以下 IAM 角色:
如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限。
部署工作器池
如需部署示例工作器池容器,请按以下步骤操作:
清理
为避免您的 Google Cloud 账号产生额外费用,请删除您在本快速入门中部署的所有资源。
删除仓库
您可能需要支付将容器映像存储在 Artifact Registry 中而产生的相关费用。如需删除 Artifact Registry 仓库,请按照 Artifact Registry 文档中删除仓库的步骤操作。
删除工作器池
示例工作器池会持续写入日志。如需停止记录日志,请按照以下步骤之一删除工作器池:
删除测试项目
删除 Google Cloud 项目后,系统即会停止对该项目中的所有资源计费。如需释放项目中的所有 Google Cloud 资源,请按照以下步骤操作:
后续步骤
如需详细了解工作器池,请参阅: