Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Configurare il progetto e il cluster in autonomia
Quando installi Cloud Service Mesh utilizzando
asmcli, può
configurare il progetto e il cluster per
te se includi il flag --enable_all o i più granulari
flag di abilitazione.
Se preferisci eseguire la configurazione autonomamente anziché lasciare che sia asmcli a apportare le modifiche, segui i passaggi descritti in questa pagina.
Se hai già installato una versione precedente di Cloud Service Mesh, non è necessario apportare modifiche al progetto o al cluster prima di utilizzare asmcli per eseguire l'upgrade alla versione più recente di Cloud Service Mesh.
Per impostazione predefinita, asmcli non installa istio-ingressgateway. Ti consigliamo di eseguire il deployment e gestire il piano di controllo e i gateway separatamente.
Cloud Service Mesh supporta l'iniezione automatica per i deployment dei gateway, il che semplifica gli upgrade di Cloud Service Mesh. Dopo l'upgrade di Cloud Service Mesh, riavvia i gateway come i tuoi servizi per acquisire la nuova configurazione del piano di controllo.
Per ulteriori informazioni, consulta
Installazione e upgrade dei gateway.
Fai clic sull'elenco a discesa nella parte superiore della pagina. Nella finestra Seleziona da visualizzata, seleziona il tuo progetto.
L'ID progetto viene visualizzato nella scheda Informazioni sul progetto della dashboard del progetto.
Crea una variabile di ambiente per il pool di carichi di lavoro utilizzando l'ID progetto:
export WORKLOAD_POOL=PROJECT_ID.svc.id.goog
Imposta i ruoli IAM (Identity and Access Management) richiesti. Se sei un
proprietario del progetto, disponi di tutte le autorizzazioni necessarie per completare
l'installazione. Se non sei un proprietario del progetto, devi avere un utente che ti conceda i seguenti ruoli IAM specifici. Nel
comando seguente, sostituisci PROJECT_ID con l'ID progetto del
passaggio precedente e GCP_EMAIL_ADDRESS con l'account che utilizzi per accedere a Google Cloud.
ROLES=(
'roles/servicemanagement.admin' \
'roles/serviceusage.serviceUsageAdmin' \
'roles/meshconfig.admin' \
'roles/compute.admin' \
'roles/container.admin' \
'roles/resourcemanager.projectIamAdmin' \
'roles/iam.serviceAccountAdmin' \
'roles/iam.serviceAccountKeyAdmin' \
'roles/gkehub.admin')
for role in "${ROLES[@]}"
do
gcloud projects add-iam-policy-binding PROJECT_ID \
--member "user:GCP_EMAIL_ADDRESS" \
--role="$role"
done
Se includi il flag --enable_all o --enable_gcp_iam_roles quando esegui asmcli, vengono impostati i ruoli IAM richiesti.
Oltre a mesh.googleapis.com, questo comando abilita anche le seguenti API:
API
Finalità
Può essere disattivato
meshconfig.googleapis.com
Cloud Service Mesh utilizza l'API Mesh Configuration per inoltrare i dati di configurazione dal tuo mesh a Google Cloud. Inoltre, l'abilitazione dell'API Mesh Configuration ti consente di accedere alle pagine di Cloud Service Mesh nella Google Cloud console e di utilizzare l'autorità di certificazione Cloud Service Mesh.
No
meshca.googleapis.com
Relativa all'autorità di certificazione Cloud Service Mesh utilizzata da Cloud Service Mesh gestito.
No
container.googleapis.com
Obbligatorio per creare cluster Google Kubernetes Engine (GKE).
No
gkehub.googleapis.com
Obbligatorio per gestire il mesh come parco risorse.
No
monitoring.googleapis.com
Obbligatorio per acquisire la telemetria per i carichi di lavoro mesh.
No
stackdriver.googleapis.com
Obbligatorio per utilizzare l'interfaccia utente dei servizi.
No
opsconfigmonitoring.googleapis.com
Obbligatorio per utilizzare l'interfaccia utente dei servizi per i clusterGoogle Cloud esterni.
No
connectgateway.googleapis.com
Obbligatorio affinché il control plane di Cloud Service Mesh gestito possa accedere ai carichi di lavoro di mesh.
Sì*
trafficdirector.googleapis.com
Consente un piano di controllo gestito altamente disponibile e scalabile.
Sì*
networkservices.googleapis.com
Consente un piano di controllo gestito altamente disponibile e scalabile.
Sì*
networksecurity.googleapis.com
Consente un piano di controllo gestito altamente disponibile e scalabile.
Sì*
L'attivazione delle API può richiedere un minuto o più. Quando le API sono attivate, viene visualizzato un output simile al seguente:
Inizializza il progetto per prepararlo all'installazione. Tra le altre cose, questo comando crea un account di servizio per consentire ai componenti del piano dati, come il proxy sidecar, di accedere in modo sicuro ai dati e alle risorse del progetto.
Nel comando seguente, sostituisci FLEET_PROJECT_ID con il
progetto host del parco risorse:
Il comando risponde con parentesi graffe vuote: {}
Per i cluster GKE su Google Cloud ,
imposta la zona o la regione predefinita per Google Cloud CLI. Se
non imposti il valore predefinito qui, assicurati di specificare l'opzione --zone o
--region nei comandi gcloud container clusters in questa pagina.
Se hai un cluster a zona singola, imposta la zona predefinita:
gcloud config set compute/zone CLUSTER_LOCATION
Se hai un cluster regionale, imposta la regione predefinita:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Set up your project and cluster yourself\n========================================\n\nWhen you install Cloud Service Mesh using\n[`asmcli`](/service-mesh/v1.22/docs/asmcli-reference), it can\nconfigure your project and your cluster for\nyou if you include the `--enable_all` flag or the more granular\n[enablement flags](/service-mesh/v1.22/docs/asmcli-reference#enablement_flags).\nIf you prefer to do the setup yourself rather than having `asmcli` make the\nchanges, follow the steps on this page.\n\nIf you already have a previous version of Cloud Service Mesh installed, you don't\nneed to make any changes to your project or cluster before using\n[`asmcli` to upgrade](/service-mesh/v1.22/docs/upgrade/upgrade) to the latest\nCloud Service Mesh version.\n\nBy default, `asmcli` doesn't install the `istio-ingressgateway`. We\nrecommend that you deploy and manage the control plane and gateways separately.\nCloud Service Mesh supports auto-injection for gateway deployments, which makes\nCloud Service Mesh upgrades easier. After upgrading Cloud Service Mesh, you restart the\ngateways just like your services to pick up the new control plane configuration.\nFor more information, see\n[Installing and upgrading gateways](/service-mesh/v1.22/docs/operate-and-maintain/gateways).\n| **Warning:** On upgrades, `asmcli` removes the default `istio-ingressgateway` from the `istio-system` namespace. If you need the default `istio-ingressgateway` installed with the in-cluster control plane, include the `--option legacy-default-ingressgateway` argument.\n\nBefore you begin\n----------------\n\n- Review the prerequisites and requirements ([outside Google Cloud](/service-mesh/v1.22/docs/onboarding/kubernetes-off-gcp/install/cloud-service-mesh-prerequisites), [GKE](/service-mesh/v1.22/docs/../legacy/in-cluster/cloud-service-mesh-prerequisites))\n- Plan the installation ([outside Google Cloud](/service-mesh/v1.22/docs/onboarding/kubernetes-off-gcp/install/plan-install), [GKE](/service-mesh/v1.22/docs/../legacy/in-cluster/plan-install)) or the [upgrade](/service-mesh/v1.22/docs/unified-install/plan-upgrade)\n- Install the required tools ([outside Google Cloud](/service-mesh/v1.22/docs/onboarding/kubernetes-off-gcp/install/install-dependent-tools), [GKE](/service-mesh/v1.22/docs/../legacy/in-cluster/install-dependent-tools))\n\nSet up your project\n-------------------\n\n1. Get the project ID for the project that the cluster was\n created in.\n\n ### gcloud\n\n Run the following command: \n\n gcloud projects list\n\n ### Console\n\n 1. Go to the [**Dashboard** page](https://console.cloud.google.com/home) in the\n Google Cloud console.\n\n [Go to the Dashboard page](https://console.cloud.google.com/home)\n 2. Click the drop-down list at the top of the page. In the\n **Select from** window that appears, select your project.\n\n The project ID is displayed on the project Dashboard **Project info**\n card.\n2. Create an environment variable for the workload pool using the project ID:\n\n export WORKLOAD_POOL=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e.svc.id.goog\n\n3. Set the required Identity and Access Management (IAM) roles. If you are a\n *Project Owner* , you have all the necessary permissions to complete\n the installation. If you aren't a *Project Owner* , you need someone who is\n to grant you the following specific IAM roles. In the\n following command, replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the\n project ID from the previous step and \u003cvar translate=\"no\"\u003eGCP_EMAIL_ADDRESS\u003c/var\u003e\n with the account that you use to sign in to Google Cloud.\n\n ROLES=(\n 'roles/servicemanagement.admin' \\\n 'roles/serviceusage.serviceUsageAdmin' \\\n 'roles/meshconfig.admin' \\\n 'roles/compute.admin' \\\n 'roles/container.admin' \\\n 'roles/resourcemanager.projectIamAdmin' \\\n 'roles/iam.serviceAccountAdmin' \\\n 'roles/iam.serviceAccountKeyAdmin' \\\n 'roles/gkehub.admin')\n for role in \"${ROLES[@]}\"\n do\n gcloud projects add-iam-policy-binding \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n --member \"user:\u003cvar translate=\"no\"\u003eGCP_EMAIL_ADDRESS\u003c/var\u003e\" \\\n --role=\"$role\"\n done\n\n If you include the `--enable_all` or `--enable_gcp_iam_roles` flag when\n you run `asmcli`, it sets the required IAM roles for you.\n4. Enable the required Google APIs:\n\n gcloud services enable \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n mesh.googleapis.com\n\n In addition to `mesh.googleapis.com`, this command also enables the\n following APIs:\n | **Note:** Some required APIs have transitive dependencies on other APIs.\n\n \u003cbr /\u003e\n\n | **Warning:** Disabling `connectgateway.googleapis.com`, `trafficdirector.googleapis.com`, `networkservices.googleapis.com`, and/or `networksecurity.googleapis.com` causes managed Cloud Service Mesh control plane to stop working. If the fleet does not use managed Cloud Service Mesh on any cluster, then these APIs can be disabled.\n\n Enabling the APIs can take a minute or more to complete. When the APIs\n are enabled, you see output similar to the following: \n\n ```\n Operation \"operations/acf.601db672-88e6-4f98-8ceb-aa3b5725533c\" finished\n successfully.\n ```\n\n If you include the `--enable_all` or `--enable_apis` flag when you run\n `asmcli`, it enables the required APIs for you.\n\nSet up your cluster\n-------------------\n\nIf you include the `--enable_all` flag, or one of the more granular\n[enablement flags](/service-mesh/v1.22/docs/unified-install/reference#enablement_flags),\n`asmcli` sets up your cluster for you.\n\n1. [Register the cluster to the fleet](/anthos/fleet-management/docs/fleet-creation).\n\n2. Initialize your project to ready it for installation. Among other things,\n this command creates a service account to let data plane components, such\n as the sidecar proxy, securely access your project's data and resources.\n In the following command replace \u003cvar translate=\"no\"\u003eFLEET_PROJECT_ID\u003c/var\u003e with\n the\n [fleet host project](/anthos/multicluster-management/fleets#fleet-host-project):\n\n **Warning:** If your `FLEET_PROJECT_ID` is the same as your `PROJECT_ID`, then remove the `\"FLEET_PROJECT_ID.hub.id.goog\",` from the following command. Otherwise, you will receive an error code due to `INVALID_ARGUMENT`. \n\n curl --request POST \\\n --header \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\"workloadIdentityPools\":[\"\u003cvar translate=\"no\"\u003eFLEET_PROJECT_ID\u003c/var\u003e.hub.id.goog\",\"\u003cvar translate=\"no\"\u003eFLEET_PROJECT_ID\u003c/var\u003e.svc.id.goog\",\"\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e.svc.id.goog\"]}' \\\n \"https://meshconfig.googleapis.com/v1alpha1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e:initialize\"\n\n The command responds with empty curly braces: `{}`\n3. For GKE on Google Cloud clusters,\n set the default zone or region for the Google Cloud CLI. If\n you don't set the default here, be sure to specify either the `--zone` or\n `--region` option in the `gcloud container clusters` commands on this page.\n\n - If you have a single-zone cluster, set the default zone:\n\n gcloud config set compute/zone \u003cvar translate=\"no\"\u003eCLUSTER_LOCATION\u003c/var\u003e\n\n - If you have a regional cluster, set the default region:\n\n gcloud config set compute/region \u003cvar translate=\"no\"\u003eCLUSTER_LOCATION\u003c/var\u003e\n\n4. For GKE on Google Cloud clusters, enable\n [Workload Identity](/kubernetes-engine/docs/how-to/workload-identity):\n\n gcloud container clusters update \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n --workload-pool=${WORKLOAD_POOL}\n\n Enabling Workload Identity can take up to 10 to 15 minutes.\n5. For GKE on Google Cloud clusters, enable\n [Cloud Monitoring and Cloud Logging on GKE](/monitoring/kubernetes-engine):\n\n gcloud container clusters update \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n --enable-stackdriver-kubernetes\n\nYour project and cluster are now ready for a new installation using `asmcli`.\n\nWhat's next\n-----------\n\n- [Install dependent tools and validate cluster outside Google Cloud](/service-mesh/v1.22/docs/onboarding/kubernetes-off-gcp/install/install-dependent-tools)\n- [Install dependent tools and validate cluster on GKE](/service-mesh/v1.22/docs/../legacy/in-cluster/install-dependent-tools)"]]