Download icon
ChatCompletion icon
OpenAI icon
Script icon
Docker icon
SlackIncomingWebhook icon
If icon
Pause icon
Apply icon

AI Kubernetes Workload Hardening and Security Policy Advisor

Automatically audit Kubernetes deployments for container security misconfigurations using Kestra AI, generate hardened manifests, and gate application behind approvals.

Categories
AICloudInfrastructure

How it works

This workflow downloads a target Kubernetes manifest (Deployment, StatefulSet, or Pod) and performs automated static security analysis against CIS Kubernetes benchmarks and NSA/CISA workload guidance.

  1. Download Manifest: Retrieves the raw Kubernetes manifest via io.kestra.plugin.core.http.Download.
  2. AI Security Evaluation: Uses Kestra's native AI completion task (io.kestra.plugin.ai.completion.ChatCompletion) with structured JSON schema outputs to detect container misconfigurations (root execution, missing capability drops, unconfined privilege escalation, and missing probes).
  3. Artifact Generation: Produces a ready-to-deploy hardened YAML manifest (hardened-deployment.yaml) alongside an executive Markdown audit report (k8s-security-audit-report.md).
  4. Team Notification: Alerts platform and DevSecOps engineers via Slack with compliance scores and findings.
  5. Approval Gate & Application: When auto_apply is enabled, pauses execution via io.kestra.plugin.core.flow.Pause for manual engineer sign-off before applying the hardened manifest to the cluster using io.kestra.plugin.kubernetes.kubectl.Apply.

What you get

  • A hardened, ready-to-deploy Kubernetes YAML manifest (hardened-deployment.yaml).
  • A comprehensive security audit report (k8s-security-audit-report.md) stored as an execution artifact.
  • Automated Slack notification with compliance scores.
  • A human-in-the-loop approval gate preventing unreviewed cluster modifications.

Who it's for

  • DevOps, DevSecOps, and Platform Engineering teams operating Kubernetes clusters.
  • Developers wanting to ensure their manifests comply with cluster admission policies.

Why orchestrate this with Kestra

Kestra coordinates the entire end-to-end lifecycle: from manifest download and native AI evaluation to artifact generation, team notification, and human-in-the-loop approval gates before cluster application.

Prerequisites

  • An OpenAI API Key.
  • A Slack Incoming Webhook URL.

Secrets

  • OPENAI_API_KEY: Your OpenAI API key.
  • SLACK_WEBHOOK_URL: Your Slack Incoming Webhook URL.

Quick start

Set the required secrets in your Kestra namespace, provide a manifest URL, and trigger execution.

How to extend

You can extend this workflow by archiving the audit reports to AWS S3 or Google Cloud Storage, or opening an automated GitHub pull request with the hardened manifest.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.