An intelligent Agentic Kubernetes CLI assistant that integrates your local MCP server with AWS Bedrock, enabling natural language control over kubectl commands, cluster management, and real-time Kubernetes insights.
- Conversational
kubectlinterface β execute commands in plain English - AI-powered command generation and validation
- Context-aware management of clusters and namespaces
- Real-time monitoring: pods, logs, resources, and events
- β Resource Management β List, describe, and manage Kubernetes resources
- π Troubleshooting Assistant β Analyze logs and diagnose issues
- π Context Switching β Move between clusters easily
- β‘ Interactive CLI β Friendly prompt-driven interface
Below is an example interaction between the User and the Agentic Kubernetes CLI demonstrating real-time troubleshooting and remediation.
π§βπ» User: list all pods in the cluster
π€ Agent: There are no running pods, but one pod nginx is showing an issue (ImagePullBackOff).
π§βπ» User: analyze the issue with nginx pod
π€ Agent: Issue identified β the container image tag nginx:lt is incorrect and not found in the registry.
π§βπ» User: fix the image tag issue and make the pod running
π€ Agent: Updated the image tag to nginx:latest, redeployed the pod, and verified that it is now Running successfully.
Demo.mp4
- Python 3.12+
- kubectl
- Access to a running Kubernetes cluster
- AWS account with Bedrock API access
- Enable Claude models in the AWS Bedrock console
- Configure AWS credentials with Bedrock access
- Ensure IAM permissions for
bedrock:InvokeModel
# Clone the repository
git clone https://github.com/Tarique-B-DevOps/Agentic-Kubernetes-CLI.git
cd Agentic-Kubernetes-CLI
# Install dependencies
pip install -r requirements.txt
# Verify kubectl installation
kubectl version --client
# Run the agent
python3 agent.pySet or export the following variables before running the agent:
# AWS Bedrock Configuration
export BEDROCK_MODEL_REGION=us-east-1
export BEDROCK_MODEL_ID=apac.anthropic.claude-3-5-sonnet-20241022-v2:0
# AWS Credentials (optional if configured with AWS CLI)
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_REGION=us-east-1python3 agent.pyβ kubectl> list all pods in production namespace
β kubectl> what's wrong with my nginx deployment?
β kubectl> show me the last 100 logs from api-server
β kubectl> switch to staging clusterβ kubectl> show all pods in the clusterAI Response:
β
Command executed successfully:
NAME READY STATUS RESTARTS AGE
nginx-7854ff8877-2kxq9 1/1 Running 0 5d
api-server-abc123 1/1 Running 2 3d
β kubectl> why is my app-server pod failing?AI Response:
Analyzing pod app-server...
Issue: ImagePullBackOff
Root Cause: Container exits with code 1
Last Error: Connection refused to database:5432
Suggestion: Check database service and credentials
β kubectl> get the last 50 lines of logs from nginx pod and summarizeβ kubectl> list all available clusters
β kubectl> switch to production-cluster
β kubectl> what's my current context?β kubectl> scale nginx deployment to 5 replicasβ kubectl> show all resources in kube-system namespace
β kubectl> get all deployments across all namespaces{
"command": "kubectl get pods -n default -o json",
"return_code": 0,
"stdout": "...",
"success": true
}{
"action": "list",
"success": true,
"output": "..."
}