CertGrid CertGrid
Hands-on Lab·Kubernetes and Cloud Native Associate

PromQL Query Basics

Query Prometheus from a Pod instead of a port-forward. Four queries: how many targets exist, how many are down, which jobs they belong to, and how busy the cluster really is.

Observability Guide 37 of 46 Beginner

Metric names are stable across these versions; the numbers in the output are from this cluster and yours will differ.

Prometheus scrapes from inside the cluster, so the queries here run from a Pod in the same namespace rather than through a port-forward.
Server NameIP AddressOSRolesCPURAMHDD
CKA1001192.168.0.175Ubuntu 26.04 LTSControl Plane Node2 Core4 GB50 GB
CKA1001-NODE01192.168.0.176Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB
CKA1001-NODE02192.168.0.177Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB
CKA1001-NODE03192.168.0.178Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB

This guide includes

Use this when Prometheus is running and you need to ask it something useful. This matters because the first questions worth asking are about Prometheus itself - which targets it is failing to scrape - and PromQL is how you ask them.

Before you start

  1. A Pod to query from

  2. How many targets, and how many are broken

  3. Group them, because a count is not a diagnosis

  4. Two queries that answer real questions

Official sources