Skip to main content

Claude Prompt for Kubernetes Monitoring with Prometheus

Set up Kubernetes monitoring with Prometheus, Grafana, and Alertmanager, including custom dashboards, alert rules, and recording rules.

Füllen Sie die Platzhalter aus

Edit the values, then copy your finished prompt.

Ihr Prompt
prompt.txt

                                

What this prompt does

This prompt has the AI stand up a complete Kubernetes monitoring stack for a [cluster_type] cluster running [workload_count] workloads. It installs kube-prometheus-stack via Helm with [retention_period] retention on [storage_class], creates ServiceMonitors for [custom_apps] scraping [metrics_port], writes PrometheusRules for [alert_scenarios], builds Grafana dashboards including [app_name]-specific [app_metrics], configures Alertmanager routing critical alerts to [critical_channel] and warnings to [warning_channel] with [silence_hours] quiet hours, adds recording rules, and wires blackbox-exporter for [external_endpoints].

The structure works because it separates collection (ServiceMonitors), alerting (PrometheusRules), visualization (Grafana), and routing (Alertmanager) into the distinct objects Prometheus actually uses. Routing critical pages separately from warnings, with quiet hours for non-critical, is what keeps the on-call signal useful instead of noisy. Recording rules pre-compute expensive percentile queries so dashboards stay fast under load. Sizing the install to [workload_count] workloads with [retention_period] retention on [storage_class] keeps the stack itself from becoming a resource hog, which is a common failure mode when monitoring is bolted on without capacity planning.

When to use it

  • You are standing up monitoring on a new cluster and want dashboards and alerts before something breaks.
  • You need ServiceMonitors to scrape custom application metrics from [custom_apps].
  • Your on-call is noisy and you want critical pages routed separately from warnings.
  • You want alert rules for the standard failure classes — crash loops, high error rate, high latency, disk pressure.
  • You need endpoint and certificate-expiry monitoring for [external_endpoints] via blackbox-exporter.
  • You want recording rules so p50/p95/p99 latency queries do not slow your dashboards down.
  • You want [app_name]-specific dashboards alongside the cluster and namespace overviews, not just generic node graphs.

Example output

Expect a Helm values file for kube-prometheus-stack, ServiceMonitor manifests for [custom_apps], PrometheusRule objects covering [alert_scenarios] with severities and for-durations, Grafana dashboard definitions (cluster overview, namespace consumption, and [app_name] metrics), an Alertmanager routing config splitting [critical_channel] from [warning_channel] with [silence_hours], recording rules for request/error/latency, and a blackbox-exporter probe config for [external_endpoints].

Pro tips

  • Route [critical_channel] and [warning_channel] separately from day one; a flat routing tree is the fastest way to make on-call ignore alerts.
  • Set sensible for/duration on each alert in [alert_scenarios] so a brief blip does not page someone — sustained, not momentary, conditions should fire.
  • Write recording rules for the expensive percentile queries before building dashboards on them, or your Grafana panels will lag under load.
  • Size [retention_period] and [storage_class] together; longer retention on slow storage gets expensive, so match retention to what you actually query.
  • Add certificate-expiry checks for [external_endpoints] via blackbox-exporter — expired certs are a predictable, preventable outage.
  • Keep [silence_hours] for non-critical only; critical pages must always break through regardless of the quiet window.
  • Tie the [app_name] dashboard to the [app_metrics] that actually predict trouble — request rate, error rate, and latency percentiles — rather than every metric the app emits.
  • Confirm [custom_apps] expose a Prometheus-format endpoint on [metrics_port] before writing ServiceMonitors, since a monitor scraping a missing endpoint fails silently.

Frequently Asked Questions

Does this route critical and warning alerts to different places?
Yes — Alertmanager routing sends critical alerts to `[critical_channel]` and warnings to `[warning_channel]`, with `[silence_hours]` quiet hours for non-critical alerts only. Critical pages always break through, which keeps the on-call signal meaningful instead of noisy.
Can it scrape metrics from my own applications?
It creates ServiceMonitor resources for `[custom_apps]` that expose metrics on `[metrics_port]` at the /metrics endpoint. Your apps need to actually expose a Prometheus-format endpoint for the ServiceMonitor to scrape, so confirm that instrumentation exists first.
Why does it include recording rules?
Recording rules pre-compute expensive queries like request rate, error rate, and p50/p95/p99 latency so dashboards stay fast. Without them, percentile panels can lag badly on a busy cluster, so they are worth setting up before building dashboards on those queries.
Does it monitor external endpoints and certificate expiry?
It adds blackbox-exporter to probe `[external_endpoints]` including certificate expiry checks. That catches a predictable class of outage — expired TLS certificates — before it takes a public endpoint down.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

Mehr in Docker & Kubernetes Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support