Interview Observability

What is the Prometheus Operator, and what are ServiceMonitor and PodMonitor? [Intermediate]

Answer

The Prometheus Operator manages Prometheus, Alertmanager, and related configuration as Kubernetes custom resources. ServiceMonitor and PodMonitor define how Prometheus discovers and scrapes service endpoints or pods.

Technical explanation

ServiceMonitor is usually preferred when a stable Service fronts application pods.

PodMonitor is useful when scraping pods directly, such as sidecars, daemon workloads, or jobs without a service.

The Operator converts these custom resources into Prometheus scrape configuration.

Hands-on example

ServiceMonitor example:

apiVersion: monitoring.coreos.com/v1

kind: ServiceMonitor

metadata:

name: checkout

spec:

selector:

matchLabels:

app: checkout

endpoints:

- port: metrics

interval: 30s

Then confirm the target appears under Status -> Targets.

Preparing for an interview?

Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.

More Observability interview questions

← All Observability questions