A new app team wants to be monitored on your Kubernetes cluster using the Prometheus Operator. What do you give them?
BeginnerScenarioPrometheus and PromQL at Scale
Answer
Situation read → With the Operator, teams self-serve using CRDs. They do not edit prometheus.yml.
What I'd do →
- The app exposes
/metricson a named port in its Service. - The team creates a
ServiceMonitorselecting that Service.
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata: {name: checkout, labels: {release: kube-prometheus-stack}}
spec:
selector: {matchLabels: {app: checkout}}
endpoints: [{port: http-metrics, interval: 30s}]
- They add alerts as a
PrometheusRule. - Confirm the target appears under Status → Targets.
Why → The Operator reconciles CRDs into Prometheus config, so teams get safe self-service.
Interview tip → The release label must match the Prometheus serviceMonitorSelector, which is the usual first mistake.
More on Prometheus and PromQL at Scale
Prometheus memory has grown to 60 GB and keeps climbing. How do you find the cause?IntermediateA developer added `user_id` as a metric label. What is the problem and what do you advise?BeginnerYour dashboard shows the average of per-pod p99 latencies. Why is it wrong, and how do you compute a correct fleet-wide p99?IntermediateChoose histogram bucket boundaries for a service with a 300 ms latency SLO.AdvancedYou have 500 short-lived batch jobs that finish before Prometheus can scrape them. How do you capture their metrics?IntermediateYour EC2 fleet autoscales constantly. How do you keep Prometheus targets up to date?Intermediate