Daily Cross-Stack Compliance Audit with OPA
Collect AWS and Kubernetes facts, evaluate them with a central OPA policy, and alert Slack on any violations.
Restart Kubernetes Deployments from alerts, auto-healing staging and requiring human approval for protected production namespaces.
Turn incident response into a governed workflow. A monitoring alert supplies a target namespace and Deployment through a secured webhook. The flow validates the namespace against an allowlist. Allowed non-production namespaces proceed automatically, while protected production namespaces require explicit human approval for up to one hour. Approval timeout fails closed. Kestra then performs a real rolling restart and retries deployment-status checks. Slack receives success or failure notifications.
alert_webhook trigger accepts POST requests secured by K8S_REMEDIATION_WEBHOOK_KEY, with namespace and deployment_name parameters.parse_webhook_payload resolves the requested target. validate_namespace rejects missing deployment names and namespaces outside the configured allowlist.production_approval_gate checks whether the namespace is in protected_namespaces. Staging and other unprotected allowed namespaces skip approval and continue automatically.human_approval pauses execution for up to one hour. An explicit resume is required; behavior: FAIL ensures timeout cannot reach the restart.restart_service performs a real rolling restart of the named Kubernetes Deployment using secret-backed cluster credentials.get_deployment_status fetches the target Deployment and retries with exponential backoff. Slack receives the success result, while the flow-level error handler reports failures.A webhook receiver script with kubectl access is a security incident waiting to happen. Kestra adds the guardrails: a keyed webhook, explicit allowlist validation before any cluster call, secrets management for the cluster token, exponential-backoff verification as a declarative retry policy rather than a sleep loop, and an execution log that shows exactly which alert restarted what and whether it recovered.
K8S_REMEDIATION_WEBHOOK_KEY: shared key guarding the webhook trigger.K8S_MASTER_URL, K8S_CA_CERT_DATA, K8S_OAUTH_TOKEN: cluster connection settings used by all Kubernetes tasks.SLACK_WEBHOOK_URL: Slack incoming webhook for remediation reports.allowed_namespaces to the namespaces you are willing to auto-remediate.?namespace=staging&deployment_name=my-app.protected_namespaces when they require human approval before remediation.allowed_namespaces when automatic remediation is appropriate.pauseDuration to match your production incident-response policy.