Menginstal Cloud Monitoring pada cluster yang terpasang EKS
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menjelaskan cara menyiapkan pengumpulan data terkelola dengan
Google Cloud Managed Service for Prometheus untuk
cluster terlampir GKE. Fitur ini tersedia di cluster Google Cloud yang menjalankan Kubernetes versi 1.25 atau yang lebih baru. Fitur ini juga didukung di cluster Kubernetes versi 1.24 untuk pelanggan yang sebelumnya mendaftar untuk mendapatkan pratinjau fitur ini di versi tersebut.
Dengan fitur ini, Anda dapat menggunakan resource PodMonitoring untuk memilih metrik yang ingin Anda masukkan ke Cloud Monitoring. Selanjutnya, Anda dapat melihat metrik ini di konsol Google Cloud .
Batasan
Fitur ini tidak tersedia di platform versi yang lebih lama dari 1.23.0-gke.2
Fitur ini memerlukan beban kerja Linux.
Menyiapkan pengumpulan data terkelola
Untuk menyiapkan pengumpulan data terkelola dengan Managed Service for Prometheus, selesaikan langkah-langkah berikut:
Beri otorisasi akun layanan gmp-system/collector dan gmp-system/rule-evaluator untuk menulis metrik Anda:
Ganti GOOGLE_PROJECT_ID dengan ID project Google Cloud
Anda.
Penambahan binding IAM ini akan gagal kecuali jika setidaknya satu
cluster telah dibuat di project Google Cloud Anda. Hal ini karena
workload identity pool yang dirujuknya
(GOOGLE_PROJECT_ID.svc.id.goog) tidak disediakan hingga
pembuatan cluster.
Untuk mengonfigurasi metrik workload yang ingin Anda masukkan, siapkan resource
PodMonitoring. Untuk contohnya, lihat
Mengonfigurasi resource PodMonitoring
dalam pengumpulan data terkelola dengan dokumentasi Managed Service for Prometheus.
Setelah Anda mengaktifkan pengumpulan data terkelola dengan Managed Service for Prometheus, cluster terlampir GKE akan membuat namespace
gmp-system. Jangan ubah atau deploy apa pun di namespace ini.
Cluster terpasang GKE juga membuat namespace gmp-public. Managed Service for Prometheus menggunakan namespace gmp-public untuk men-deploy resource OperatorConfig.
Memperbarui konfigurasi Prometheus
Untuk menonaktifkan atau mengaktifkan kembali pengumpulan data Prometheus, gunakan
perintah gcloud container attached clusters update. Saat mengupdate cluster, sertakan flag opsional
--disable-managed-prometheus atau --enable-managed-prometheus.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-31 UTC."],[],[],null,["# Install Cloud Monitoring on EKS attached clusters\n\nThis page explains how you can set up managed data collection with\n[Google Cloud Managed Service for Prometheus](/stackdriver/docs/managed-prometheus) for\nGKE attached clusters. This feature is available on Google Cloud 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\n- This feature is not available on platform versions earlier than 1.23.0-gke.2\n\n\u003c!-- --\u003e\n\n- This feature requires a Linux workload.\n\nSet up managed data collection\n------------------------------\n\nTo set up managed data collection with Managed Service for Prometheus, complete the following steps:\n| **Note:** Starting with GKE Enterprise 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. Use the\n [`gcloud container attached clusters register` command](/sdk/gcloud/reference/container/attached/clusters/register)\n to register the cluster, and include the optional\n `--enable-managed-prometheus` flag.\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 attached clusters creates the\n`gmp-system` namespace. Don't modify or deploy anything in this namespace.\nGKE attached clusters 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\n------------------------------------\n\nTo disable or re-enable Prometheus data collection, use the\n[`gcloud container attached clusters update` command](/sdk/gcloud/reference/container/attached/clusters/update). When updating the cluster, include either the\n`--disable-managed-prometheus` or `--enable-managed-prometheus` optional flag.\n\nWhat's next\n-----------\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."]]