I'm trying to migrate from GKE workload metrics to Managed Service for Prometheus metrics.
To do this I deploy a PodMonitoring resource to emit metrics that can be scraped by Prometheus following the Migrating from GKE workload metrics to Managed Service for Prometheus doc by Google (using same version as they use in the doc).
My service-config.yaml below:
apiVersion: monitoring.googleapis.com/v1
kind: PodMonitoring
metadata:
labels:
deployment_unit: test-unit
global_label: my-label
name: my-service
namespace: my-namespace
spec:
endpoints:
- interval: 30s
path: /metrics
port: http-prometheus
scheme: http
selector:
matchLabels:
app: my-service
But I keep seeing the error in my build when I try to deploy the service.
No matches for kind "PodMonitoring" in version "monitoring.googleapis.com/v1"
My GKE version is 1.23.14.
Make sure that you have enabled Google Managed Prometheus on your cluster.