カスタム組織のポリシーを使用したフリート管理
組織ポリシー サービスとカスタム制約を使用すると、組織の Managed Service for Apache Spark クラスタ全体に特定の構成を適用できます。この一元化されたアプローチにより、コンプライアンスの確保、費用の管理、Managed Service for Apache Spark フリートの標準化が可能になります。
このガイドでは、Managed Service for Apache Spark クラスタのカスタム組織のポリシーを作成して適用する方法について説明します。詳細については、組織のポリシーの概要をご覧ください。
始める前に
-
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.
Enable the Resource Manager API.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. 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.-
Make sure that you have the following role or roles on the project: Organization Policy Administrator
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.
Go to IAM - Select the project.
- Click Grant access.
-
In the New principals field, enter your user identifier. This is typically the identifier for a user in a workforce identity pool. For details, see Represent workforce pool users in IAM policies, or contact your administrator.
- Click Select a role, then search for the role.
- To grant additional roles, click Add another role and add each additional role.
- Click Save.
-
-
Google Cloud CLI をインストールします。
-
フェデレーション ID(連携 ID)を使用するように gcloud CLI を構成します。
詳細については、連携 ID を使用して gcloud CLI にログインするをご覧ください。
-
gcloud CLI を初期化するには、次のコマンドを実行します:
gcloud init
カスタム制約を適用する
次の手順では、一般的なセキュリティ要件(すべての新しい Managed Service for Apache Spark クラスタで Kerberos が有効になっていること)を適用する方法について説明します。
カスタム制約を定義します。
- 次の内容で 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 に置き換えます。カスタム制約を設定して、組織で使用できるようにします。
gcloud org-policies set-custom-constraint CONSTRAINT_PATHCONSTRAINT_PATHは、YAML 制約ファイルのパスに置き換えます。制約を適用する組織のポリシーを作成します。
- 次の内容で別の YAML ファイルを作成します。
name: projects/PROJECT_ID/policies/custom.dataprocKerberos spec: rules: - enforce: truePROJECT_IDは、ポリシーを適用するプロジェクト に置き換えます。このポリシーは、フォルダレベルまたは 組織レベルで適用することもできます。ポリシーを適用します。
gcloud org-policies set-policy POLICY_PATHPOLICY_PATHは、YAML ポリシー ファイルのパスに置き換えます。
ポリシーを適用すると、指定したリソースに Kerberos を有効にせずに Managed Service for Apache Spark クラスタを作成しようとすると失敗します。
カスタム制約のユースケース
カスタム制約を作成して、Managed Service for Apache Spark フリートに幅広いポリシーを適用できます。フリート ポリシーを適用すると、費用の管理、標準化、セキュリティに役立ちます。
例: 特定のマシンタイプを必須にしたり、クラスタノードでパブリック IP アドレスを禁止したりできます。
次のステップ
- 組織のポリシーの概要を読む
- カスタム 制約について詳細を学習する。