Pengelolaan fleet dengan kebijakan organisasi kustom
Anda dapat menggunakan Organization Policy Service dengan batasan kustom untuk menerapkan konfigurasi tertentu di seluruh cluster Managed Service for Apache Spark organisasi Anda. Pendekatan terpusat ini membantu memastikan kepatuhan, mengontrol biaya, dan menstandardisasi fleet Managed Service for Apache Spark Anda.
Panduan ini menunjukkan cara membuat dan menerapkan kebijakan organisasi kustom untuk cluster Managed Service for Apache Spark. Untuk mengetahui informasi selengkapnya, lihat Pengantar Kebijakan Organisasi.
Sebelum memulai
- Login ke akun Google Cloud Anda. Jika Anda baru menggunakan Google Cloud, buat akun untuk mengevaluasi performa produk kami dalam skenario dunia nyata. Pelanggan baru juga mendapatkan kredit gratis senilai $300 untuk menjalankan, menguji, dan men-deploy workload.
-
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 Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. 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 email address for a Google Account.
- Click Select a role, then search for the role.
- To grant additional roles, click Add another role and add each additional role.
- Click Save.
-
-
Instal Google Cloud CLI.
-
Jika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.
-
Untuk melakukan inisialisasi gcloud CLI, jalankan perintah berikut:
gcloud init -
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 Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. 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 email address for a Google Account.
- Click Select a role, then search for the role.
- To grant additional roles, click Add another role and add each additional role.
- Click Save.
-
-
Instal Google Cloud CLI.
-
Jika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.
-
Untuk melakukan inisialisasi gcloud CLI, jalankan perintah berikut:
gcloud init
Menerapkan batasan khusus
Langkah-langkah berikut menunjukkan cara menerapkan persyaratan keamanan umum: memastikan bahwa semua cluster Managed Service for Apache Spark yang baru mengaktifkan Kerberos.
Tentukan batasan kustom.
- Buat file YAML dengan konten berikut:
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.Ganti
ORGANIZATION_IDdengan ID organisasi Anda.Tetapkan batasan kustom agar tersedia untuk organisasi Anda.
gcloud org-policies set-custom-constraint CONSTRAINT_PATHGanti
CONSTRAINT_PATHdengan jalur ke file batasan YAML Anda.Buat kebijakan organisasi yang menerapkan batasan.
- Buat file YAML lain dengan konten berikut:
name: projects/PROJECT_ID/policies/custom.dataprocKerberos spec: rules: - enforce: trueGanti
PROJECT_IDdengan ID project untuk menerapkan kebijakan. Anda juga dapat menerapkan kebijakan ini di tingkat folder atau organisasi.Terapkan kebijakan.
gcloud org-policies set-policy POLICY_PATHGanti
POLICY_PATHdengan jalur ke file kebijakan YAML.
Setelah Anda menerapkan kebijakan, upaya untuk membuat cluster Managed Service for Apache Spark di resource yang ditentukan tanpa mengaktifkan Kerberos akan gagal.
Kasus penggunaan untuk batasan kustom
Anda dapat membuat batasan kustom untuk menerapkan berbagai kebijakan untuk fleet Managed Service for Apache Spark Anda. Menerapkan kebijakan fleet membantu mengontrol biaya, melakukan standardisasi, dan meningkatkan keamanan.
Contoh: Anda dapat mewajibkan jenis mesin tertentu atau mencegah alamat IP publik di node cluster.
Langkah berikutnya
- Baca Pengantar Kebijakan Organisasi
- Pelajari lebih lanjut batasan kustom.