Repair stale Pushgateway labels for a live Kestra batch job
Reconcile stale Pushgateway labels with Kestra execution history then rewrite the batch metrics behind approval.
A Kestra blueprint that aggregates Kubernetes Warning events per object and alerts on Slack when one spikes, without spamming.
list_events (io.kestra.plugin.scripts.shell.Commands) dumps the namespace's events as JSON with kubectl.find_spikes (io.kestra.plugin.scripts.python.Script) keeps only Warning events, groups them by involved object, and sums the per-event counts. Any object at or above spike_threshold is spiking. It compares against the KV state so only new spikes alert, and quotes the top reasons plus one sample message per object.maybe_alert (io.kestra.plugin.core.flow.If) posts the Slack alert only when there is a new spike.save_state (io.kestra.plugin.core.kv.Set) writes back the currently spiking objects. Events expire on their own in Kubernetes, so a fixed issue fades from the list and a fresh spike alerts again.Anyone running Kubernetes who only looks at events after something already broke. This watches them continuously and tells you when the noise becomes a signal.
Events are ephemeral and easy to miss; a scheduled flow turns them into a reliable signal. Kestra holds the cluster credentials as secrets, keeps every run's findings where you can audit them, and the KV state means the second run does not re-alert the same spike.
| Secret | What it is |
|---|---|
CLIENT_CRT |
base64-encoded client certificate from your kubeconfig |
CLIENT_KEY |
base64-encoded client key from your kubeconfig |
MASTERURL |
base64-encoded Kubernetes API server URL, reachable from inside the Kestra container |
SLACK_WEBHOOK |
base64-encoded Slack Incoming Webhook URL |
In Kestra OSS, secrets come from environment variables prefixed with SECRET_ and must be base64-encoded. If the API URL uses 127.0.0.1 or localhost, replace it with host.docker.internal so the Kestra container can reach it.
SECRET_ environment variables.namespace: quiet if warnings are flat.| Input | Type | Default | What it does |
|---|---|---|---|
namespace |
STRING | default |
the namespace whose events to watch |
spike_threshold |
INT | 10 |
alert when an object's warning count reaches this |
slack_webhook |
STRING | (required) | Incoming webhook URL of the Slack channel for alerts |
spike_threshold per namespace after the first week.