Building a K8s-Native AI Governance Platform with OPA and ML-BOM
AI workloads on Kubernetes are exploding. But governance? That's a mess.
We have models running in production, shadow AI workloads we don't know about, and zero visibility into who deployed what. Compliance teams are panicking. Security teams are overwhelmed.
That's why I built Project-Aegis.
๐ฏ Project-Aegis is an open-source, Kubernetes-native AI governance platform that discovers, scans, and enforces policies on AI/ML workloads in real-time.
๐ GitHub: github.com/Hyelzor/Project-Aegis
๐ฅ The Problem: AI Governance is Broken
Here's what I kept running into:
ยท Shadow AI โ Models deployed without anyone knowing
ยท No audit trail โ Who deployed what, and when?
ยท Manual policy enforcement โ Good luck applying consistent rules across 50+ clusters
ยท Compliance nightmares โ Finance, healthcare, and regulated industries need proof, not promises
Most existing solutions are either:
ยท Cloud-specific (lock-in)
ยท Too heavy (enterprise bloat)
ยท Not designed for Kubernetes-native workflows
I wanted something that works out of the box with Helm, integrates with OPA for policies, and gives me tamper-evident audit logs out of the box.
So I built it.
๐๏ธ Architecture Overview
Here's how Project-Aegis works:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Kubernetes Cluster โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ AI Agent โ โ AI Agent โ โ k8s-aibom โ โ
โ โ (LangChain)โ โ (LangChain)โ โ Controller โ โ
โ โโโโโโโโฌโโโโโโโ โโโโโโโโฌโโโโโโโ โโโโโโโโโโโโฌโโโโโโโโโโโ โ
โ โ โ โ โ
โ โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ [WebSocket] โ
โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Aegis Backend (FastAPI) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โข ML-BOM Ingestion โข Policy Engine (OPA Rego) โ โ
โ โ โข OpenA2A Scanner โข Audit Logger (HMAC chain) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโผโโโโโโโ โ
โ โ PostgreSQL โ โ
โ โ (16) โ โ
โ โโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ React Dashboard โ
โ (Real-time policy visualization) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Tech stack:
ยท Backend: Python 3.11 + FastAPI + SQLAlchemy
ยท Database: PostgreSQL 16
ยท Policy Engine: OPA Rego
ยท Frontend: React 18 + Vite + Tailwind + Recharts
ยท Orchestration: Kubernetes + Helm
ยท Agent SDK: TypeScript 5.x + LangChain wrapper
๐ง Key Features
1๏ธโฃ ML-BOM Discovery & Ingestion
A Kubernetes controller (k8s-aibom) automatically discovers AI models deployed on your clusters and generates ML-BOM (Machine Learning Bill of Materials) documents.
Every model gets tracked โ no more shadow AI.
2๏ธโฃ OpenA2A Vulnerability Scanning
Every valid ML-BOM triggers an automated OpenA2A scan via webhook. Vulnerabilities are detected before they reach production.
3๏ธโฃ Real-Time OPA Policy Enforcement
Policies are written in Rego and enforced in real-time:
# Example: Block vLLM deployments
deny[msg] {
input.kind == "Deployment"
input.spec.template.spec.containers[_].image == "vllm/vllm"
msg = "vLLM deployments are blocked by policy"
}
The policy engine supports three actions:
ยท Block โ Prevent the workload from running
ยท Allow โ Permit the workload
ยท Mask โ Redact sensitive data from logs
4๏ธโฃ Tamper-Evident Audit Logs
This is one of my favorite features. Every audit log entry is hashed using HMAC-SHA256 in a chain:
Log 1 โ Hash(Log 1 + Secret)
Log 2 โ Hash(Log 2 + Hash(Log 1 + Secret))
Log 3 โ Hash(Log 3 + Hash(Log 2 + ...))
If someone modifies a log entry, the chain breaks โ and you can prove it. Critical for finance, healthcare, and regulated industries.
5๏ธโฃ React Dashboard
A clean, real-time dashboard shows:
ยท All ML-BOMs across clusters
ยท Policy violations
ยท Audit trail
ยท Scan results
๐ Getting Started in 5 Minutes
Option 1: Docker Compose (Local Dev)
git clone https://github.com/Hyelzor/Project-Aegis.git
cd Project-Aegis
make docker-up
Option 2: Helm Chart (Kubernetes)
helm repo add aegis https://hyelzor.github.io/Project-Aegis
helm install aegis aegis/aegis
That's it. The dashboard is available at http://localhost:3000.
๐ Real-World Validation
We recently had users test Aegis on staging clusters. The shadow AI detection caught two orphaned workloads they didn't even know were running.
One user said:
"Helm install was shockingly painless and the OPA policies started blocking my test workload right away, exactly as configured. Wish more k8s tools had audit trails this clean out of the box."
Another added:
"The shadow AI detection caught two orphaned workloads in our staging cluster that I didn't even know were running โ which was both reassuring and slightly terrifying."
๐ฎ What's Next?
The platform is production-ready, but here's what I'm thinking about:
ยท More policy templates โ Pre-built Rego rules for common AI frameworks
ยท Slack/Email alerts โ Real-time notifications for policy violations
ยท Multi-cluster support โ Centralized governance across 100+ clusters
ยท CNCF Sandbox โ Eventually, I'd love to donate this to the CNCF
๐ฌ Let's Talk
I'd love your feedback on:
- The OPA Rego policies โ Are they comprehensive enough?
- The HMAC audit chain โ Any edge cases I missed?
- ML-BOM discovery โ What models/frameworks should I support next?
Drop a comment below or open an issue on GitHub.
๐ GitHub: github.com/Hyelzor/Project-Aegis
โญ Star it if you find it useful!
Built with โค๏ธ for the Kubernetes and AI community.
Top comments (0)