Kube-AutoFix: Autonomous Kubernetes SRE Agent

A closed-loop autonomous agent that monitors, diagnoses, and self-heals Kubernetes clusters using GPT-4o Structured Outputs with deny-by-default validation guardrails.

OpenAI GPT-4oKubernetesPythonPydanticMLflowYAMLStructured Outputs

Problem Statement

Kubernetes misconfiguration is the #1 cause of outages in cloud-native environments. Traditional debugging requires manual log analysis, which is slow and error-prone. Kube-AutoFix automates the entire lifecycle: detect → diagnose → propose fix → validate → apply — without human intervention.

Architecture

Autonomous Healing Loop
Observation
LLM Core
Guardrails
DeployApply K8s manifests
MonitorWatch pod health & events
DiagnoseGPT-4o Structured Outputs
ValidatePydantic guardrails
RepairNamespace-isolated fix
ObserveMLflow experiment log
Closed-loop architecture: automatically re-enters Monitor state after every fix attempt.

Key Innovation: Deny-by-Default Validation

Problem: LLMs hallucinate YAML. If an AI agent generates a Kubernetes manifest with an invalid Kind, missing namespace, or privilege escalation, deploying it could destroy your cluster.

Solution: Every proposed mutation passes through a Pydantic validation pipeline that enforces structural invariants before any kubectl apply. The agent operates on a deny-by-default policy — if the fix doesn't pass every check, it is rejected and the agent re-diagnoses.

Result: Zero unvalidated changes reach the cluster. The agent reduces risk of cascading failures from LLM hallucinations.

Latest Release

Visual Assets

Architecture diagram and terminal screenshots coming soon.

Check the GitHub repository for the latest code and documentation.

Measurable Results

100%

Mutation validation coverage

< 30s

Average diagnosis-to-fix cycle

0

Unvalidated changes deployed

MLflow

Full experiment tracking integration

What I Learned

  • How to use OpenAI Structured Outputs with response_format to enforce JSON schema compliance — not just prompt engineering, but actual compile-time guarantees on LLM output shape.
  • Building a deny-by-default security model for AI-generated infrastructure changes — the importance of never trusting LLM output without structural validation.
  • Designing autonomous agent loops that balance speed with safety: every cycle must include diagnosis, proposal, validation, and rollback capability.
  • Integrating MLflow experiment tracking to log every agent decision — transforming opaque AI behavior into auditable, comparable experiment runs.

Zaynul Abedin Miah

CS Student Building AI & Cloud-Native Tools

BRAC University '27

Partner Resources

Check Dubbing v2 Access
Browse Cloud-Native Certifications

Code ZAYNUL for 30% off, if still valid.

Affiliate links. I may earn a commission if you sign up.

© 2026 Zaynul Abedin Miah. All rights reserved.

Trademarks and logos belong to their respective owners and are used only to identify public community affiliations.