AI-powered Kubernetes assistant and SRE agent using the Claude Agent SDK.
Heimdall is an interactive TUI for Kubernetes diagnostics - ask questions in natural language and get intelligent answers powered by AI.
- Interactive TUI - Natural language interface for K8s diagnostics
- Auto-load Context - Automatically uses current-context from kubeconfig
- Multi-Model Support - Claude Sonnet/Opus/Haiku, GPT, Gemini
- Web Search - Search for error messages, CVEs, deprecated APIs
- Cancellable Queries - Press ESC to cancel running queries
- Thinking Summary - Each response includes a brief high-level reasoning summary
- Kubectl JSON Cache - Short TTL cache reduces repeated
kubectl get -o jsoncalls
- Node.js 18+
kubectlconfigured with access to your Kubernetes clusterANTHROPIC_API_KEYenvironment variable
# Clone the repository
git clone https://github.com/your-username/heimdall.git
cd heimdall
# Install dependencies
npm install
# Set up environment variable
export ANTHROPIC_API_KEY="your-api-key-here"# Development
npm run dev
# Or build and run
npm run build
npm startOn launch, Heimdall automatically:
- Loads the
current-contextfrom your kubeconfig - Uses the default namespace for that context (or
kube-systemif none)
| Command | Description |
|---|---|
/ctx |
Switch Kubernetes context |
/ns |
Switch namespace |
/model |
Change AI model |
/resume |
Browse and resume saved sessions |
/continue |
Continue most recent session |
/rename <name> |
Name current session |
/context |
Show current session info |
/new |
Start a new session |
/clear |
Clear conversation history |
/help |
Show available commands |
/exit |
Exit Heimdall |
heimdall> check pdb configuration
heimdall> why is my pod in CrashLoopBackOff?
heimdall> list all deployments with less than 2 replicas
heimdall> explain the network policies in this namespace
| Option | Description | Default |
|---|---|---|
-k, --kubeconfig <path> |
Path to kubeconfig file | ~/.kube/config |
-v, --verbose |
Show verbose output including tool calls | false |
Heimdall resumes the active session by default, so short follow-ups like "3" keep context.
Use /new to start fresh, or /resume//continue to switch sessions.
By default, Heimdall caches kubectl get ... -o json outputs for 30 seconds to reduce
repeat API calls in tight tool loops.
Environment variables:
HEIMDALL_KUBECTL_CACHE=0 # disable cache
HEIMDALL_KUBECTL_CACHE_TTL=30 # TTL in seconds (default: 30)
HEIMDALL_KUBECTL_CACHE_DIR=/tmp # override cache directorynpm run dev # Run in development mode
npm run typecheck # Type check
npm run build # Build
npm test # Run tests
npm run test:coverage # Run tests with coverageHeimdall uses the Claude Agent SDK to:
- Run kubectl commands via the built-in Bash tool
- Search the web for error messages and documentation
- Analyze output using AI understanding of Kubernetes
- Provide focused answers to your specific questions
The agent operates in advisory mode - it runs read-only commands and provides information to help you make decisions.
MIT