커스텀 조직 정책을 사용한 Fleet 관리

커스텀 제약조건과 함께 조직 정책 서비스를 사용하여 조직의 Managed Service for Apache Spark 클러스터 전반에 특정 구성을 적용할 수 있습니다. 이 중앙 집중식 접근 방식을 사용하면 규정 준수를 보장하고, 비용을 제어하고, Managed Service for Apache Spark Fleet을 표준화할 수 있습니다.

이 가이드에서는 Managed Service for Apache Spark 클러스터의 커스텀 조직 정책을 만들고 적용하는 방법을 보여줍니다. 자세한 내용은 조직 정책 소개를 참고하세요.

시작하기 전에

  1. 계정에 로그인합니다. Google Cloud 를 처음 사용하는 경우 계정을 만들고 Google 제품의 실제 성능을 평가해 보세요. 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. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Resource Manager API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  5. Make sure that you have the following role or roles on the project: Organization Policy Administrator

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. 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.

    4. 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

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. Click Grant access.
    4. In the New principals field, enter your user identifier. This is typically the email address for a Google Account.

    5. Click Select a role, then search for the role.
    6. To grant additional roles, click Add another role and add each additional role.
    7. Click Save.
  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. Verify that billing is enabled for your Google Cloud project.

  11. Enable the Resource Manager API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  12. Make sure that you have the following role or roles on the project: Organization Policy Administrator

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. 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.

    4. 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

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. Click Grant access.
    4. In the New principals field, enter your user identifier. This is typically the email address for a Google Account.

    5. Click Select a role, then search for the role.
    6. To grant additional roles, click Add another role and add each additional role.
    7. Click Save.
  13. Google Cloud CLI를 설치합니다.

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

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

    gcloud init

커스텀 제약조건 적용

다음 단계에서는 모든 새 Managed Service for Apache Spark 클러스터에 Kerberos가 사용 설정되어 있는지 확인하는 일반적인 보안 요구사항을 적용하는 방법을 보여줍니다.

  1. 커스텀 제약조건을 정의합니다.

    1. 다음 콘텐츠로 YAML 파일을 만듭니다.
    name: organizations/ORGANIZATION_ID/customConstraints/custom.dataprocKerberos
    resourceTypes:
    -   dataproc.googleapis.com/Cluster
    methodTypes:
    -   CREATE
    condition: "resource.config.securityConfig.kerberosConfig.enableKerberos == true"
    actionType: ALLOW
    displayName: Cluster must have Kerberos enabled.
    

    ORGANIZATION_ID를 조직 ID로 바꿉니다.

  2. 커스텀 제약조건을 설정하여 조직에서 사용할 수 있도록 합니다.

    gcloud org-policies set-custom-constraint CONSTRAINT_PATH
    

    CONSTRAINT_PATH를 YAML 제약조건 파일의 경로로 바꿉니다.

  3. 제약조건을 적용하는 조직 정책을 만듭니다.

    1. 다음 콘텐츠로 다른 YAML 파일을 만듭니다.
    name: projects/PROJECT_ID/policies/custom.dataprocKerberos
    spec:
      rules:
        -   enforce: true
    

    PROJECT_ID를 정책을 적용할 프로젝트의 ID로 바꿉니다. 폴더 또는 조직 수준에서 이 정책을 적용할 수도 있습니다.

  4. 정책을 적용합니다.

    gcloud org-policies set-policy POLICY_PATH
    

    POLICY_PATH를 YAML 정책 파일의 경로로 바꿉니다.

정책을 적용한 후에는 Kerberos가 사용 설정되지 않은 지정된 리소스에서 Managed Service for Apache Spark 클러스터를 만들려고 하면 실패합니다.

커스텀 제약조건의 사용 사례

커스텀 제약조건을 만들어 Managed Service for Apache Spark Fleet에 다양한 정책을 적용할 수 있습니다. Fleet 정책을 적용하면 비용 관리, 표준화, 보안에 도움이 됩니다.

예: 특정 머신 유형을 요구하거나 클러스터 노드에서 공개 IP 주소를 방지할 수 있습니다.

다음 단계