ניהול ה-Fleet באמצעות מדיניות ארגונית מותאמת אישית

אתם יכולים להשתמש בOrganization Policy Service עם אילוצים בהתאמה אישית כדי לאכוף הגדרות ספציפיות באשכולות של Managed Service for Apache Spark בארגון. הגישה המרכזית הזו עוזרת להבטיח תאימות, לשלוט בעלויות ולתקנן את צי המכונות שלכם ב-Managed Service for Apache Spark.

במדריך הזה מוסבר איך ליצור ולאכוף מדיניות ארגונית בהתאמה אישית עבור אשכולות של Managed Service for Apache Spark. מידע נוסף זמין במאמר מבוא למדיניות הארגון.

לפני שמתחילים

  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. 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. התקינו את ה-CLI של Google Cloud.

  7. אם אתם משתמשים בספק זהויות חיצוני (IdP), קודם אתם צריכים להיכנס ל-CLI של gcloud באמצעות המאגר המאוחד לניהול זהויות.

  8. כדי לאתחל את ה-CLI של gcloud, הריצו את הפקודה הבאה:

    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. התקינו את ה-CLI של Google Cloud.

  14. אם אתם משתמשים בספק זהויות חיצוני (IdP), קודם אתם צריכים להיכנס ל-CLI של gcloud באמצעות המאגר המאוחד לניהול זהויות.

  15. כדי לאתחל את ה-CLI של gcloud, הריצו את הפקודה הבאה:

    gcloud init

החלת אילוץ מותאם אישית

בשלבים הבאים מוסבר איך לאכוף דרישת אבטחה נפוצה: לוודא ש-Kerberos מופעל בכל האשכולות החדשים של Managed Service for Apache Spark.

  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 במזהה הארגון.

  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 במזהה הפרויקט שרוצים להחיל עליו את המדיניות. אפשר להחיל את המדיניות הזו גם ברמת התיקייה או הארגון.

  4. מחילים את המדיניות.

    gcloud org-policies set-policy POLICY_PATH
    

    מחליפים את הערך POLICY_PATH בנתיב לקובץ מדיניות ה-YAML.

אחרי שמחילים את המדיניות, ניסיון ליצור אשכול של Managed Service for Apache Spark במשאב שצוין בלי ש-Kerberos מופעל ייכשל.

תרחישי שימוש במגבלות מותאמות אישית

אתם יכולים ליצור אילוצים מותאמים אישית כדי לאכוף מגוון רחב של כללי מדיניות בצי שלכם ב-Managed Service for Apache Spark. החלת מדיניות על צי הרכבים עוזרת לשלוט בעלויות, ליצור סטנדרטיזציה ולשפר את האבטחה.

דוגמה: אפשר לדרוש סוגים ספציפיים של מכונות או למנוע כתובות IP ציבוריות בצמתי אשכול.

המאמרים הבאים