Interview Prep/Monitoring & Observability/Observability as Code, Security & Vendor Choices

How do you secure Prometheus and Alertmanager endpoints?

IntermediateProductionObservability as Code, Security & Vendor Choices
Answer

By default both serve unauthenticated HTTP, and anyone who reaches them can read every metric (which may leak hostnames, versions and business numbers) or create silences. Layers we apply:

  • Do not expose them publicly. Access through Grafana, an authenticating reverse proxy (oauth2-proxy) or kubectl port-forward.
  • Native TLS and basic auth via --web.config.file:
tls_server_config:
  cert_file: /etc/prometheus/tls/tls.crt
  key_file: /etc/prometheus/tls/tls.key
basic_auth_users:
  grafana: $2y$10$...bcrypt-hash...
  • NetworkPolicies so only Grafana, the rule evaluators and the proxy can reach port 9090/9093.
  • Keep --web.enable-admin-api off.
All Monitoring & Observability questions

More on Observability as Code, Security & Vendor Choices