Prepare and test your skills

Prepare and test your skills

Google Cloud Managed Service for Prometheus (opens in a new tab) is a fully managed monitoring solution that separates metric collection from global storage and querying. Collectors scrape Prometheus exporters in Kubernetes, virtual machine, or serverless environments and forward the data to Monarch, the globally scalable datastore that stores data for 24 months and answers PromQL queries. Both collection modes send data to Monarch for long-term storage and global querying, but they differ in who operates the collectors, how scraping is configured, and how much operational work is required.
Exporters on GKE, Compute Engine, and Cloud Run are scraped by managed, self-deployed, and Ops Agent collectors that push to Monarch, which stores data for 24 months and serves PromQL queries to Cloud Monitoring and Grafana.
Managed collection is Google's recommended, operator-driven method for collecting Prometheus metrics in Kubernetes environments, including Google Kubernetes Engine (GKE) and non-GKE clusters. When managed collection is enabled (opens in a new tab), a Kubernetes operator installs in-cluster components that generate scrape configurations, scale ingestion, and scope rules to the right data. Data flows from exporter endpoints on each node to a local collector, and then from the collector to Monarch in a Google Cloud region for storage and global querying.
Scraping is configured with lightweight custom resources instead of full Prometheus configuration files. A PodMonitoring resource scrapes pods in one namespace, a ClusterPodMonitoring resource scrapes pods in any namespace, and a ClusterNodeMonitoring resource scrapes node components like kubelet and cAdvisor. Managed collection can be deployed with the GKE console, gcloud CLI, kubectl CLI, or Terraform, and it is enabled by default on GKE Autopilot clusters version 1.25 and greater and GKE Standard clusters version 1.27 and greater. On GKE, the components upgrade automatically and receive full assistance from Google Cloud technical support.
Self-deployed collection is a method where you continue to operate your own Prometheus servers using a drop-in replacement binary for upstream Prometheus. When self-deployed collection is used (opens in a new tab), the server scrapes local exporters as it always has, evaluates recording and alerting rules locally when configured that way, and forwards collected data and rule results to Monarch for long-term storage. Because the Prometheus server runs locally, local rule evaluation does not require network traffic to the cloud, which can help edge deployments.
You deploy and scale self-deployed collectors with your preferred mechanism, such as prometheus-operator or manual deployment, and you configure scraping with existing methods such as annotations or operator configs. Scaling and functional sharding are done manually, and you can run upstream Prometheus and Managed Service for Prometheus side by side during migration. This mode receives limited assistance from Google Cloud technical support, but it supports long-tail use cases not yet covered by managed collection, such as local aggregations to reduce cardinality before upload.
The choice between collection modes depends on operational overhead, existing infrastructure, and control requirements. Managed collection minimizes hands-on work, while self-deployed collection preserves existing configs and local control:
| Option | Who operates collectors | How scraping is configured | Best use case |
|---|---|---|---|
| Managed collection | Kubernetes operator manages scrape configs, scaling, and upgrades | PodMonitoring, ClusterPodMonitoring, and ClusterNodeMonitoring custom resources | New or standard GKE workloads that want a hands-off experience and full support |
| Self-deployed collection | You deploy, scale, and shard Prometheus servers manually | Existing Prometheus configs, annotations, or prometheus-operator | Complex existing setups, side-by-side migration, edge sites needing local rule evaluation, or local aggregation to control costs |
Exam tip: Choose managed collection when you want Google Cloud to handle scaling and configuration through custom resources, and choose self-deployed collection when you must reuse complex existing Prometheus configs or evaluate rules locally without cloud network traffic.
Google Cloud Managed Service for Prometheus (opens in a new tab) querying and visualization means using PromQL to retrieve metrics stored in the global Monarch datastore and viewing results in Cloud Monitoring or Grafana. Collectors scrape Prometheus exporters and forward the data to Monarch, and Monarch executes queries and returns results to any tool that can call the Prometheus query API. This design gives one global view across regions, projects, and clouds without managing Prometheus servers.
Global query evaluation is the process where Monarch, the globally scalable datastore behind Cloud Monitoring, runs PromQL queries against all accessible Prometheus data. Data flows from managed collectors, self-deployed collectors, the OpenTelemetry Collector (opens in a new tab), or the Ops Agent to Monarch for storage, and query requests flow from Grafana or the Cloud Monitoring UI to Monarch for evaluation. Monarch unions results across all Google Cloud regions and across up to 3,500 Google Cloud projects in a metrics scope. Because Grafana connects to Monarch instead of connecting to individual Prometheus servers, a single Grafana instance can show metrics from Kubernetes, virtual machines, Cloud Run, on-premises, and other clouds together.
PromQL in Cloud Monitoring lets you retrieve both Managed Service for Prometheus metrics and native Cloud Monitoring metrics with the same language. You can run PromQL queries in Metrics Explorer in the Google Cloud console without changing existing queries from open-source dashboards or community examples. PromQL can query several types of data in Cloud Monitoring, even without sending data to Managed Service for Prometheus:
To verify data and chart results in Metrics Explorer, follow this workflow in the Google Cloud console:
This workflow keeps existing Grafana dashboards, PromQL-based alerts, and workflows working when you switch from local Prometheus to the managed service.
Visualization with Grafana means pointing Grafana at the Monarch backend so dashboards query the global store through the Prometheus query API. Grafana sends PromQL queries to Monarch, Monarch evaluates them against long-term stored data, and Grafana renders the returned time series in charts and dashboards. Existing Grafana dashboards continue to work because the managed service stays compatible with upstream Prometheus. Cloud Monitoring dashboards provide the same unified access in the Google Cloud console, where you can chart Prometheus metrics alongside native monitoring data for comprehensive observability.
Exam tip: Grafana queries Monarch, not individual Prometheus servers, and PromQL can query Cloud Monitoring metrics even if you have not sent any data to Managed Service for Prometheus.
Google Cloud Managed Service for Prometheus (opens in a new tab) with managed collection uses a Kubernetes operator and node-level collectors to handle scraping, but the collectors do nothing until scraping targets are defined. PodMonitoring and ClusterPodMonitoring custom resources define those targets by selecting pods and describing how to scrape their metrics endpoints. Data flows from each discovered pod to its node-local collector, then from the collector to Monarch for long-term storage and global querying.
Managed collection components include the gmp-operator Deployment, which builds scrape configuration, and the collector DaemonSet, which performs the actual scraping and forwards data to Monarch. Each collector scrapes only pods running on the same node as that collector, which lets collection scale horizontally as nodes are added. After managed collection is enabled (opens in a new tab), no metrics flow until a PodMonitoring or ClusterPodMonitoring resource with valid endpoints is deployed, or a built-in metrics package is enabled.
PodMonitoring is a namespace-scoped custom resource that tells collectors which pods to scrape inside one Kubernetes namespace. The PodMonitoring resource uses a Kubernetes label selector in spec.selector.matchLabels to automatically discover matching pods in its own namespace, so new pods with the same labels are picked up without changing the configuration. Scraping behavior is defined in spec.endpoints, which names the pod port to scrape, the HTTP path, and the scrape interval.
For example, a PodMonitoring resource named prom-example can select all pods labeled app.kubernetes.io/name: prom-example and scrape them on a port named metrics every 30s on the /metrics path. You can verify where PodMonitoring resources exist with kubectl get podmonitoring -A. To scrape the same workload in multiple namespaces, deploy the same PodMonitoring resource in each namespace.
ClusterPodMonitoring is a cluster-scoped custom resource that provides the same selector and endpoint interface as PodMonitoring but discovers pods across all namespaces. The managed operator expands one ClusterPodMonitoring definition into scrape targets throughout the cluster, so a single resource can cover a shared service, exporter, or application deployed in many namespaces. Data flows from each discovered pod to the collector on its node, then from the collector to Monarch for long-term storage and global querying. Choose ClusterPodMonitoring when the same metrics need collection everywhere without duplicating a PodMonitoring resource per namespace.
PodMonitoring and ClusterPodMonitoring share the same scraping model and differ mainly in discovery scope and operational use:
| Resource | Discovery scope | Choose when |
|---|---|---|
| PodMonitoring | Pods in its own namespace only | The workload lives in one namespace or each team manages its own namespace |
| ClusterPodMonitoring | Matching pods in all namespaces | The same service runs cluster-wide and should be scraped from one definition |
This scope boundary controls automation: PodMonitoring keeps discovery and ownership namespace-local, while ClusterPodMonitoring centralizes discovery for platform services and exporters that span the cluster.
Exam tip: PodMonitoring scrapes only pods in the namespace where the resource is deployed, while ClusterPodMonitoring scrapes matching pods across all namespaces.
Managed collection uses a Kubernetes operator to manage scrape configs, scaling and upgrades with PodMonitoring, ClusterPodMonitoring and ClusterNodeMonitoring custom resources, while self-deployed collection requires you to deploy, scale and shard your own Prometheus servers using existing Prometheus configs. Both modes forward data to Monarch for long-term storage and global querying, but managed collection minimizes operational work and receives full support while self-deployed collection preserves local control and local rule evaluation.
PodMonitoring scrapes only pods in the namespace where it is deployed, while ClusterPodMonitoring scrapes matching pods across all namespaces. Use PodMonitoring when the workload lives in one namespace or each team manages its own namespace, and use ClusterPodMonitoring when the same service runs cluster-wide and should be scraped from one definition.
Collectors forward metrics to Monarch, which stores data for 24 months and evaluates PromQL queries globally across regions and up to 3,500 Google Cloud projects in a metrics scope. Grafana connects to Monarch through the Prometheus query API instead of individual Prometheus servers, so a single Grafana instance or Cloud Monitoring dashboards can visualize Kubernetes, virtual machine and multi-cloud metrics together.
Your operations team has deployed Google Cloud Managed Service for Prometheus using managed collection on a Google Kubernetes Engine (GKE) cluster. You need to confirm that application targets are healthy and actively sending metrics by evaluating the standard up metric using Prometheus Query Language (PromQL). In addition, you want to view the resulting time-series chart directly within the Google Cloud console and add it to a custom dashboard.
What should you do?
Last updated