0

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.

chrisyyy
  • 45
  • 4
  • 1
    Are you sure Managed Prometheus is enabled on your cluster? – Gari Singh Mar 08 '23 at 08:25
  • Ahh yeah that's the solution! I enabled it in my test environment where this code worked. This started happening on a deploy to another environment, in which I hadn't enabled it. Thanks so much. – chrisyyy Mar 08 '23 at 20:46
  • If you want, post that as the answer so I can accept it @GariSingh – chrisyyy Mar 09 '23 at 16:58

1 Answers1

1

Make sure that you have enabled Google Managed Prometheus on your cluster.

Gari Singh
  • 11,418
  • 2
  • 18
  • 41