Cloud Deploy를 사용하여 GKE에 앱 배포

이 페이지에서는 Cloud Deploy를 사용하여 Google Kubernetes Engine 클러스터 시퀀스 2개에 nginx라는 샘플 애플리케이션 이미지를 배포하는 방법을 보여줍니다.

이 빠른 시작에서 다루는 작업은 다음과 같습니다.

  1. 클러스터 두 개를 만듭니다.

  2. Skaffold 구성 및 Kubernetes 매니페스트를 만들어 배포할(사전 빌드된) 컨테이너 이미지를 지정합니다.

  3. 두 클러스터를 가리키는 Cloud Deploy 배포 파이프라인과 배포 대상을 정의합니다.

  4. 첫 번째 타겟에 자동으로 배포되는 출시를 만들어 배포 파이프라인을 인스턴스화합니다.

  5. 출시를 두 번째 타겟으로 승격합니다.

  6. 콘솔에서 두 출시를 확인합니다. Google Cloud

시작하기 전에

  1. 계정에 로그인합니다. Google Cloud 를 처음 사용하는 경우 Google Cloud, 계정을 만들어 실제 시나리오에서 제품이 어떻게 작동하는지 평가하세요. 신규 고객에게는 워크로드를 실행, 테스트, 배포하는 데 사용할 수 있는 $300의 무료 크레딧이 제공됩니다.
  2. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.

  4. Verify that billing is enabled for your Google Cloud project.

  5. Enable the Cloud Deploy, Cloud Build, GKE, and Cloud Storage APIs.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the APIs

  6. Google Cloud CLI를 설치합니다.

  7. 외부 ID 공급업체(IdP)를 사용하는 경우 먼저 제휴 ID로 gcloud CLI에 로그인해야 합니다.

  8. gcloud CLI를 초기화하려면, 다음 명령어를 실행합니다.

    gcloud init
  9. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  10. If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.

  11. Verify that billing is enabled for your Google Cloud project.

  12. Enable the Cloud Deploy, Cloud Build, GKE, and Cloud Storage APIs.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the APIs

  13. Google Cloud CLI를 설치합니다.

  14. 외부 ID 공급업체(IdP)를 사용하는 경우 먼저 제휴 ID로 gcloud CLI에 로그인해야 합니다.

  15. gcloud CLI를 초기화하려면, 다음 명령어를 실행합니다.

    gcloud init

필요한 역할

Cloud Deploy 서비스 계정에 Cloud Deploy 작업을 실행하고 Cloud Run에 배포하는 데 필요한 권한이 있는지 확인하려면 관리자에게 프로젝트의 Cloud Deploy 서비스 계정에 다음 IAM 역할을 부여해 달라고 요청하세요.

역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.