מדריך למתחילים: פריסת מאגר עובדים לדוגמה ב-Cloud Run
בדף הזה מוסבר איך לפרוס קונטיינר לדוגמה של מאגר Worker. אחרי הפריסה, מאגר ה-workers כותב הודעת יומן באופן רציף.
לפני שמתחילים
- נכנסים לחשבון Google Cloud . אנחנו ממליצים למשתמשים חדשים ב- Google Cloud ליצור חשבון כדי שיוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
-
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.
-
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.
-
Verify that billing is enabled for your Google Cloud project.
-
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.
-
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.
-
Verify that billing is enabled for your Google Cloud project.
- למחירון של Cloud Run או למחשבון עלויות.
התפקידים הנדרשים
כדי לקבל את ההרשאות שדרושות להשלמת המדריך למתחילים, אתם צריכים לבקש מהאדמין לתת לכם את התפקידים הבאים ב-IAM:
- אדמין ב-Cloud Run (
roles/run.admin) במאגר ה-workers - משתמש בחשבון שירות (
roles/iam.serviceAccountUser) בזהות השירות - צפייה ביומנים (
roles/logging.viewer) בפרויקט
להסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.
יכול להיות שאפשר לקבל את ההרשאות הנדרשות גם באמצעות תפקידים בהתאמה אישית או תפקידים מוגדרים מראש.
פריסת מאגר ה-workers
כדי לפרוס את מאגר ה-Worker Pool לדוגמה, מבצעים את השלבים הבאים:
נכנסים ל-Cloud Run במסוף Google Cloud :
בתפריט, לוחצים על Worker pools ואז על Deploy container כדי לפתוח את הטופס Create worker pools.
לוחצים על בדיקה באמצעות מאגר תגים לדוגמה.
לוחצים על Create כדי לפרוס את קובץ האימג' ב-Cloud Run. מחכים שהפריסה תסתיים.
לוחצים על הכרטיסייה Logs כדי לראות את היומנים שנכתבו על ידי מאגר ה-Workers. מאגר ה-workers כותב כל הזמן את הודעת היומן
Cloud Run Worker Pool instance is running!.
הסרת המשאבים
כדי להימנע מחיובים נוספים בחשבון Google Cloud , צריך למחוק את כל המשאבים שפרסתם באמצעות המדריך למתחילים.
מחיקת המאגר
יכול להיות שתחויבו על אחסון קובץ האימג' של הקונטיינר ב-Artifact Registry. כדי למחוק מאגרים של Artifact Registry, פועלים לפי השלבים שמפורטים במאמר מחיקת מאגרים במסמכי התיעוד של Artifact Registry.
מחיקת מאגר ה-workers
מאגר ה-Workers לדוגמה כותב יומנים באופן רציף. כדי להפסיק את הרישום ביומן, צריך למחוק את מאגר ה-Workers באחת מהדרכים הבאות:
נכנסים ל-Cloud Run במסוף Google Cloud :
בתפריט, בוחרים באפשרות Worker pools ובוחרים את מאגר ה-workers שרוצים למחוק.
לוחצים על Delete.
מחיקת פרויקט הבדיקה
מחיקת הפרויקט ב- Google Cloud מפסיקה את החיוב על כל המשאבים באותו פרויקט. כדי לשחרר את כל המשאבים של Google Cloud בפרויקט:
- במסוף Google Cloud , נכנסים לדף Manage resources.
- ברשימת הפרויקטים, בוחרים את הפרויקט שרוצים למחוק ולוחצים על Delete.
- כדי למחוק את הפרויקט, כותבים את מזהה הפרויקט בתיבת הדו-שיח ולוחצים על Shut down.
המאמרים הבאים
מידע נוסף על מאגרי וורקרים זמין במאמרים הבאים: