Configura la raccolta gestita dei dati con Managed Service per Prometheus
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa pagina spiega come configurare la raccolta dei dati gestita con
Google Cloud Managed Service per Prometheus per GKE su AWS. Questa funzionalità è disponibile sui cluster AWS
che eseguono Kubernetes versione 1.25 o successive. È supportata anche sui cluster Kubernetes versione 1.24 per i clienti che avevano precedentemente effettuato la registrazione per un'anteprima di questa funzionalità in quella versione.
Con questa funzionalità, puoi utilizzare una risorsa PodMonitoring per scegliere le metriche che vuoi importare in Cloud Monitoring. Puoi visualizzare queste
metriche nella Google Cloud console.
Limitazioni
Questa funzionalità non è disponibile nei cluster Kubernetes precedenti alla versione 1.24.
Questa funzionalità richiede un carico di lavoro Linux.
Configurare la raccolta dei dati gestita
Per configurare la raccolta dei dati gestita con Managed Service per Prometheus, svolgi i seguenti passaggi:
Autorizza gli account di servizio gmp-system/collector e gmp-system/rule-evaluator a scrivere le metriche:
Sostituisci GOOGLE_PROJECT_ID con il tuo Google Cloud
ID progetto.
L'aggiunta di questa associazione IAM non va a buon fine a meno che nel tuo Google Cloud progetto non sia stato creato almeno un cluster. Questo accade perché il
pool di identità di carico di lavoro a cui fa riferimento
(GOOGLE_PROJECT_ID.svc.id.goog) non viene eseguito fino alla
creazione del cluster.
Crea un cluster con il comando standard gcloudCrea il tuo cluster, ma includi il flag facoltativo --enable-managed-prometheus. Ad esempio:
Per configurare le metriche del carico di lavoro da importare, imposta una risorsa PodMonitoring. Per un esempio, consulta Configurare una risorsa PodMonitoring nella documentazione sulla raccolta dei dati gestita con Managed Service per Prometheus.
Dopo aver attivato la raccolta dei dati gestita con Managed Service per Prometheus, GKE su AWS crea lo spazio dei nomi gmp-system. Non modificare o eseguire il deployment di nulla in questo spazio dei nomi.
GKE su AWS crea anche lo spazio dei nomi gmp-public. Managed Service per Prometheus utilizza lo spazio dei nomi gmp-public per eseguire il deployment della risorsa OperatorConfig.
Aggiorna la configurazione di Prometheus
Per disattivare o riattivare la raccolta dei dati di Prometheus, utilizza il comando standard
gcloudAggiorna il cluster, ma aggiungi un parametro facoltativo --disable-managed-prometheus o --enable-managed-prometheus. Ad esempio:
gcloudcontainerawsclustersupdate\...
--disable-managed-prometheus
OR
--enable-managed-prometheus
[[["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-07-31 UTC."],[],[],null,["This page explains how you can set up managed data collection with\n[Google Cloud Managed Service for Prometheus](/stackdriver/docs/managed-prometheus) for\nGKE on AWS. This feature is available on AWS clusters\nrunning Kubernetes version 1.25 or later. It is also supported on Kubernetes\nclusters at version 1.24 for customers who had earlier signed up for a\npreview of this feature on that version.\n\nWith this feature, you can use a PodMonitoring resource to choose the metrics\nthat you want to ingest into Cloud Monitoring. You can then view these\nmetrics in the Google Cloud console.\n\nLimitations\n\n- This feature is not available on Kubernetes clusters earlier than version 1.24.\n\n\u003c!-- --\u003e\n\n- This feature requires a Linux workload.\n\nSet up managed data collection\n\nTo set up managed data collection with Managed Service for Prometheus, complete the following steps:\n| **Note:** Starting with Kubernetes version 1.28, manual policy binding to authorize service accounts for data collection is no longer necessary. The required permissions are now automatically granted to this service account. You can therefore disregard step 1 in this section.\n\n1. Authorize the `gmp-system/collector` and `gmp-system/rule-evaluator` service\n accounts to write your metrics:\n\n gcloud projects add-iam-policy-binding \u003cvar translate=\"no\"\u003eGOOGLE_PROJECT_ID\u003c/var\u003e \\\n --member=\"serviceAccount:\u003cvar translate=\"no\"\u003eGOOGLE_PROJECT_ID\u003c/var\u003e.svc.id.goog[gmp-system/collector]\" \\\n --role=roles/monitoring.metricWriter\n gcloud projects add-iam-policy-binding \u003cvar translate=\"no\"\u003eGOOGLE_PROJECT_ID\u003c/var\u003e \\\n --member=\"serviceAccount:\u003cvar translate=\"no\"\u003eGOOGLE_PROJECT_ID\u003c/var\u003e.svc.id.goog[gmp-system/rule-evaluator]\" \\\n --role=roles/monitoring.viewer\n gcloud projects add-iam-policy-binding \u003cvar translate=\"no\"\u003eGOOGLE_PROJECT_ID\u003c/var\u003e \\\n --member=\"serviceAccount:\u003cvar translate=\"no\"\u003eGOOGLE_PROJECT_ID\u003c/var\u003e.svc.id.goog[gmp-system/rule-evaluator]\" \\\n --role=roles/monitoring.metricWriter\n\n Replace \u003cvar translate=\"no\"\u003eGOOGLE_PROJECT_ID\u003c/var\u003e with your Google Cloud\n project ID.\n\n Adding this IAM binding fails unless at least one\n cluster has been created in your Google Cloud project. This is because the\n workload identity pool it refers to\n (\u003cvar translate=\"no\"\u003eGOOGLE_PROJECT_ID\u003c/var\u003e`.svc.id.goog`) isn't provisioned until\n cluster creation.\n2. Create a cluster with the standard `gcloud`\n [Create your cluster](/kubernetes-engine/multi-cloud/docs/aws/how-to/create-cluster#create_your_cluster)\n command, but include the optional `--enable-managed-prometheus` flag. For\n example:\n\n gcloud container aws clusters create \\\n ...\n --enable-managed-prometheus\n\n3. To configure which workload metrics you want to ingest, set up a\n [PodMonitoring](https://github.com/GoogleCloudPlatform/prometheus-engine/blob/v0.4.3-gke.0/doc/api.md#podmonitoring)\n resource. For an example, see\n [Configure a PodMonitoring resource](/stackdriver/docs/managed-prometheus/setup-managed#gmp-pod-monitoring)\n in the managed data collection with Managed Service for Prometheus documentation.\n\nAfter you enable managed data collection with Managed Service for Prometheus, GKE on AWS creates the\n`gmp-system` namespace. Don't modify or deploy anything in this namespace.\nGKE on AWS also creates the `gmp-public` namespace. Managed Service\nfor Prometheus uses the `gmp-public` namespace to deploy the\n[OperatorConfig](https://github.com/GoogleCloudPlatform/prometheus-engine/blob/v0.4.3-gke.0/doc/api.md#operatorconfig)\nresource.\n\nUpdate your Prometheus configuration To disable or re-enable Prometheus data collection, use the standard `gcloud` [Update your cluster](/kubernetes-engine/multi-cloud/docs/aws/how-to/update-cluster#update_your_cluster) command, but add a --disable-managed-prometheus or --enable-managed-prometheus optional parameter. For example:\n\n\u003cbr /\u003e\n\n gcloud container aws clusters update \\\n ...\n --disable-managed-prometheus\n OR\n --enable-managed-prometheus\n\nWhat's next\n\n- Discover how to [Configure a query user interface](/stackdriver/docs/managed-prometheus/query) in the managed data collection with Managed Service for Prometheus documentation.\n- Learn about [Managed rule evaluation and alerting](/stackdriver/docs/managed-prometheus/rules-managed) in the Google Cloud Managed Service for Prometheus documentation."]]