Zufar Muhamadeev
Zufar Muhamadeev

Reputation: 3212

Google managed Prometheus query doesn't return any metric

I have configured Prometheus according to doc. But when I am doing query it doesn't return any metric. How can I understand why metrics scrapping doesn't work?

Configuration details:

I have updated existing cluster in cloud console. Prometheus service is Enabled: Prometheus enabled

Then I have deployed PodMonitoring resource to enable metric scraping:

apiVersion: monitoring.googleapis.com/v1
kind: PodMonitoring
metadata:
  name: test
spec:
  selector:
    matchLabels:
      app: test
  endpoints:
    - port: test
      path: /test/metrics
      interval: 30s

And here is how kubectl describe svc test looks like:

Name:              test
Namespace:         default
Labels:            app=test
Annotations:       service.alpha.kubernetes.io/tolerate-unready-endpoints: true
Selector:          app=test
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                $IP
IPs:               $IP
Port:              test  $PORT_DIGIT/TCP
TargetPort:        $PORT_DIGIT/TCP
Endpoints:         $IP:$PORT_DIGIT
Session Affinity:  None
Events:            <none>

I also have self managed prometheus - it works fine with test service.

Upvotes: 2

Views: 930

Answers (1)

neoakris
neoakris

Reputation: 5115

I created the following git gist (which is basically a public permalink) https://gist.github.com/neoakris/bfc67fef83fecde6384ab4f8afe5fc95
It covers how to troubleshoot GMP, and it includes 3 different ways of how to run PromQL Queries against Prometheus metrics.

It shows

  1. How to curl pod metric endpoint to see Prom Metrics
  2. How to run a PromQL Query using GCP Metric Explorer GUI
  3. How to run a PromQL Query using Prometheus GUI, hosted as a pod in cluster.

Upvotes: 0

Related Questions