New to Kestra?
Use blueprints to kickstart your first workflows.
Monitor a Kubernetes cluster with AI in Kestra. Collect pod, node, and deployment data, diagnose incidents with Gemini, classify severity, and alert Slack.
Continuously monitor a Kubernetes cluster for health problems and incidents without writing custom controllers or stitching together cron jobs and shell scripts. Every five minutes this flow snapshots the live state of your cluster, hands the raw data to a large language model for site reliability analysis, classifies how serious the situation is, and pages your team on Slack only when something genuinely needs attention. It turns noisy kubectl output into a concise root cause summary with concrete remediation steps, so on-call engineers spend less time triaging and more time fixing.
io.kestra.plugin.core.flow.Parallel task fans out seven io.kestra.plugin.kubernetes.kubectl.Get calls at once to collect pods, events, nodes, deployments, services, resourcequotas, and selected kube-system pod logs, each written to its own output file.io.kestra.plugin.ai.completion.ChatCompletion sends the collected data to Google Gemini (gemini-2.5-flash) acting as an SRE, returning a health summary, root cause analysis, impact assessment, and remediation commands.io.kestra.plugin.scripts.python.Script task (classify_severity) scans the AI response for keywords and labels the incident LOW, MEDIUM, or HIGH.io.kestra.plugin.slack.notifications.SlackIncomingWebhook fires only when runIf evaluates severity as HIGH, posting the full analysis to your channel.io.kestra.plugin.core.trigger.Schedule trigger runs the whole pipeline on a */5 * * * * cron.HIGH eventsKubernetes ships a scheduler for pods, not for cross-resource diagnostic workflows. Kestra adds the missing layer: event and schedule triggers, automatic retries on transient API failures, full execution lineage and replay of every snapshot and AI verdict, and a declarative YAML definition you can version in Git. The parallel collection, conditional Slack alerting, and AI step live in one auditable flow instead of scattered scripts.
K8S_MASTER_URL: Kubernetes API master URLK8S_TOKEN: OAuth token for cluster accessGOOGLE_API_KEY: Google Gemini API keySLACK_WEBHOOK_URL: Slack incoming webhook (swap in for the mock URL in production)namespace in pluginDefaults and the resource selectors to match your cluster.send_slack_summary with {{ secret('SLACK_WEBHOOK_URL') }}.MEDIUM incidents to a different channel or PagerDuty.