prop/k8s/metrics-service.yaml
Graham McIntire abb7e90d2d
prom: annotate hot pods for k8s-pods scrape via apiserver proxy
External Prometheus at 10.0.15.31 already runs the kubernetes-pods job
in prometheus.yml.j2; pods need prometheus.io/scrape + port + path +
job annotations to be picked up. The prop-metrics NodePort selector
also tightened to tier=hot so backfill (PHX_SERVER=false, no :5000
listener) is excluded from the scrape pool.
2026-05-08 10:23:30 -05:00

29 lines
935 B
YAML

apiVersion: v1
kind: Service
metadata:
name: prop-metrics
namespace: prop
labels:
app: prop
purpose: metrics
spec:
type: NodePort
# Don't pin scrapes to a single pod — we want Prometheus to sample
# across all replicas so BEAM-level metrics (memory, scheduler util)
# stay representative. DB-backed gauges (oban queue depth) are
# identical across pods so per-scrape rotation is fine there too.
sessionAffinity: None
selector:
app: prop
# Restrict to hot pods. prop-backfill carries the same `app: prop`
# label but runs PHX_SERVER=false (no listener on :5000), so an
# unscoped selector lands ~50% of scrapes on a closed port.
tier: hot
ports:
- name: metrics
# Fixed high-numbered NodePort so the external Prometheus at
# 10.0.15.31 can scrape `nodeIP:30090` without needing k8s SD.
nodePort: 30090
port: 5000
targetPort: 5000
protocol: TCP