빠른 시작: 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
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
Make sure that you have the following role or roles on the project: Cloud Run Admin, Cloud Run Developer, Logs Viewer
Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Google Cloud console, go to the IAM page.
IAM으로 이동 - 프로젝트를 선택합니다.
- 액세스 권한 부여를 클릭합니다.
-
새 주 구성원 필드에 사용자 식별자를 입력합니다. 일반적으로 Google 계정의 이메일 주소입니다.
- 역할 선택 목록에서 역할을 선택합니다.
- 역할을 추가로 부여하려면 다른 역할 추가를 클릭하고 각 역할을 추가합니다.
- 저장을 클릭합니다.
-
-
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
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
Make sure that you have the following role or roles on the project: Cloud Run Admin, Cloud Run Developer, Logs Viewer
Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Google Cloud console, go to the IAM page.
IAM으로 이동 - 프로젝트를 선택합니다.
- 액세스 권한 부여를 클릭합니다.
-
새 주 구성원 필드에 사용자 식별자를 입력합니다. 일반적으로 Google 계정의 이메일 주소입니다.
- 역할 선택 목록에서 역할을 선택합니다.
- 역할을 추가로 부여하려면 다른 역할 추가를 클릭하고 각 역할을 추가합니다.
- 저장을 클릭합니다.
-
-
서비스 ID에 서비스 계정 사용자 역할이 부여되어 있는지 확인합니다. 기본적으로 서비스 ID는 Compute Engine 기본 서비스 계정입니다.
역할 부여
서비스 ID 리소스에 대한 액세스 권한을 부여하려면
gcloud iam service-accounts add-iam-policy-binding
명령어를 사용하여 강조 표시된 변수를 적절한 값으로 바꿉니다.gcloud iam service-accounts add-iam-policy-binding SERVICE_ACCOUNT_EMAIL \ --member=user:PRINCIPAL \ --role=roles/iam.serviceAccountUser
다음을 바꿉니다.
- SERVICE_ACCOUNT_EMAIL: 서비스 ID로 사용 중인 서비스 계정 이메일 주소입니다(예:
- Compute Engine 기본 서비스 계정:
PROJECT_NUMBER-compute@developer.gserviceaccount.com
- 생성한 서비스 계정:
SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com
- Compute Engine 기본 서비스 계정:
- PRINCIPAL: 사용자 식별자입니다. 일반적으로 Cloud Run 리소스를 배포하는 Google 계정 이메일 주소입니다.
- SERVICE_ACCOUNT_EMAIL: 서비스 ID로 사용 중인 서비스 계정 이메일 주소입니다(예:
- Cloud Run 가격 책정을 검토하거나 가격 계산기로 비용을 추정합니다.
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.
작업자 풀 배포
샘플 작업자 풀 컨테이너를 배포하려면 다음 단계를 따르세요.
삭제
Google Cloud 계정에 추가 비용이 청구되지 않도록 하려면 이 빠른 시작으로 배포한 모든 리소스를 삭제합니다.
저장소 삭제
Artifact Registry에 컨테이너 이미지를 저장하는 비용이 청구될 수 있습니다. Artifact Registry 저장소를 삭제하려면 Artifact Registry 문서의 저장소 삭제 단계를 따르세요.
작업자 풀 삭제
샘플 작업자 풀은 지속적으로 로그를 작성합니다. 로깅을 중지하려면 다음 단계 중 하나를 따라 작업자 풀을 삭제하세요.
테스트 프로젝트 삭제
Google Cloud 프로젝트를 삭제하면 해당 프로젝트의 모든 리소스에 대한 청구가 중단됩니다. 프로젝트의 모든 Google Cloud 리소스를 해제하려면 다음 단계를 따르세요.
다음 단계
작업자 풀에 대한 자세한 내용은 다음을 참조하세요.