המסמך הזה הוא גרסה שעברה שינוי של התיעוד שמופיע במאגר GitHub של GCP Service Broker.
דרישות מוקדמות
- קלאסטר עם Kf מותקן.
-
gcloud: פועלים לפי ההוראות האלה כדי להתקין את ה-CLI של gcloud. -
kubectl: אחרי שמתקינים אתgcloud, מריצים אתgcloud components install kubectl. -
helm: פועלים לפי ההוראות האלה כדי להתקין אתhelmה-CLI. -
git: נדרש Git כדי לשכפל מאגר.
הגדרות אישיות
בחירת פרויקט
בוחרים את Google Cloud הפרויקט שבו רוצים להשתמש בהמשך המדריך. זה צריך להיות אותו פרויקט שבו נעשה שימוש באשכול Kf.
אתם צריכים להיות מוגדרים כבעלי הפרויקט שבחרתם. אפשר לשנות את הערכים שבהמשך כך שישקפו את הסביבה שלכם, ואז להגדיר את משתני הסביבה האלה במסוף:
export PROJECT_ID=$(gcloud config get-value project)export SERVICE_ACCOUNT_NAME=kf-gcp-broker
יצירת חשבון שירות עבור הברוקר
יוצרים את חשבון השירות:
gcloud iam service-accounts create $SERVICE_ACCOUNT_NAMEיוצרים פרטי כניסה חדשים כדי לאפשר לתווך לבצע אימות, ומורידים את פרטי הכניסה אל
key.json:gcloud iam service-accounts keys create key.json --iam-account $SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.comמעניקים לברוקר הרשאות של בעלי פרויקט:
gcloud projects add-iam-policy-binding $PROJECT_ID --member serviceAccount:$SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com --role "roles/owner"
הפעלת ממשקי ה-API הנדרשים
עכשיו צריך להפעיל ממשקי API כדי לאפשר למתווך להקצות משאבים.
לסוכן יש כמה ממשקי API שנדרשים להרצת הסוכן, וכמה ממשקי API אופציונליים שצריך להפעיל כדי להקצות משאבים מסוג מסוים.
כדי שהברוקר יפעל, צריך להשתמש בממשקי Cloud Resource Manager API ובממשקי Identity and Access Management API. כדי להפעיל אותן:
gcloud services enable cloudresourcemanager.googleapis.com iam.googleapis.com --project $PROJECT_IDהפעלת ממשקי ה-API
כדי להקצות שירותי ענן בפרויקט, מומלץ להפעיל לפחות את ממשקי ה-API הבאים:
GCP Service Broker תומך גם במגוון שירותים אחרים שאפשר להוסיף להם תמיכה על ידי הפעלת ממשקי ה-API שמפורטים כאן.
התקנת מתווך השירותים
משכפלים את GCP Service Broker אל תחנת העבודה המקומית ומעבירים את
cdאליו:git clone --depth=1 "https://github.com/GoogleCloudPlatform/gcp-service-broker"cd gcp-service-broker/deployments/helm/gcp-service-brokerמעדכנים את התלויות של תרשים Helm:
helm dependency updateעורכים את הקובץ
values.yamlומגדירים את הערך שלbroker.service_account_jsonכמחרוזת שמכילה את כל התוכן שלkey.json.אופציונלי: קוראים את שאר המאפיינים ומשנים את אלה שצריך כדי להתאים לסביבה שלכם.
# ... broker: # ... service_account_json: "contents of key.json go here" # ...
אם מריצים בסביבת ייצור, צריך להגדיר את
mysql.embeddedכ-false ולספק פרטי כניסה למסד נתונים חיצוני של MySQL עם גיבויים אוטומטיים ויתירות כשל.יוצרים מרחב שמות של Kubernetes בשביל GCP Service Broker:
kubectl create namespace gcp-service-brokerמתקינים את הברוקר:
helm install gcp-service-broker --set svccat.register=false --namespace gcp-service-broker .רושמים את הברוקר ב-Kf:
kf create-service-broker gcp-service-broker \ "$(kubectl get secret gcp-service-broker-auth -n gcp-service-broker -o jsonpath='{.data.username}' | base64 --decode)" \ "$(kubectl get secret gcp-service-broker-auth -n gcp-service-broker -o jsonpath='{.data.password}' | base64 --decode)" \ "http://gcp-service-broker.gcp-service-broker.svc.cluster.local"
אישור ההתקנה של הברוקר
מריצים את kf marketplace. הפלט אמור להיראות כך:
Broker Name Space Status Description
gcp-service-broker google-stackdriver-profiler Active Continuous CPU and heap profiling to improve performance and reduce costs.
gcp-service-broker google-stackdriver-monitoring Active Stackdriver Monitoring provides visibility into the performance, uptime, and overall health of cloud
gcp-service-broker google-dataflow Active A managed service for executing a wide variety of data processing patterns built on Apache Beam.
gcp-service-broker google-cloudsql-mysql Active Google CloudSQL for MySQL is a fully-managed MySQL database service.
gcp-service-broker google-spanner Active The first horizontally scalable, globally consistent, relational database service.
gcp-service-broker google-ml-apis Active Machine Learning APIs including Vision, Translate, Speech, and Natural Language.
gcp-service-broker google-pubsub Active A global service for real-time and reliable messaging and streaming data.
gcp-service-broker google-datastore Active Google Cloud Datastore is a NoSQL document database service.
gcp-service-broker google-stackdriver-debugger Active Stackdriver Debugger is a feature of the Google Cloud Platform that lets you inspect the state of an
gcp-service-broker google-firestore Active Cloud Firestore is a fast, fully managed, serverless, cloud-native NoSQL document database that simp
gcp-service-broker google-bigtable Active A high performance NoSQL database service for large analytical and operational workloads.
gcp-service-broker google-storage Active Unified object storage for developers and enterprises. Cloud Storage allows world-wide storage and r
gcp-service-broker google-stackdriver-trace Active Stackdriver Trace is a distributed tracing system that collects latency data from your applications
gcp-service-broker google-cloudsql-postgres Active Google CloudSQL for PostgreSQL is a fully-managed PostgreSQL database service.
gcp-service-broker google-dialogflow Active Dialogflow is an end-to-end, build-once deploy-everywhere development suite for creating conversatio
gcp-service-broker google-bigquery Active A fast, economical and fully managed data warehouse for large-scale data analytics.
ה-GCP Service Broker מותקן ואפשר להשתמש בו כדי ליצור שירותים ולקשר אותם לאפליקציות שפורסים באמצעות Kf.