# Agentic Kubernetes CLI

> Agentic AI system that transforms natural language into kubectl commands via Strands Agent and MCP server integration.

- **Type:** MCP server
- **Install:** `agentstack add mcp-tarique-b-devops-agentic-kubernetes-cli`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Tarique-B-DevOps](https://agentstack.voostack.com/s/tarique-b-devops)
- **Installs:** 0
- **Category:** [Cloud & Infrastructure](https://agentstack.voostack.com/c/cloud-infrastructure)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Tarique-B-DevOps](https://github.com/Tarique-B-DevOps)
- **Source:** https://github.com/Tarique-B-DevOps/Agentic-Kubernetes-CLI

## Install

```sh
agentstack add mcp-tarique-b-devops-agentic-kubernetes-cli
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Agentic Kubernetes CLI

[](https://www.python.org/downloads/)
[](https://kubernetes.io/)
[](https://aws.amazon.com/bedrock/)
[](LICENSE)

> **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**.

---

## 🚀 Features

### 🗣️ Natural Language Kubernetes Operations
- Conversational `kubectl` interface — 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

### ⚙️ Advanced Capabilities
- ✅ **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

---

## 🎥 Demo

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.

---

  
  Your browser does not support the video tag.

[🎥 Watch Full Demo Video](https://github.com/user-attachments/assets/c30c4288-793c-4554-98ac-185075a621f0)

---

## 📚 Table of Contents

- [Prerequisites](#-prerequisites)
- [Installation](#-installation)
- [Configuration](#-configuration)
- [Usage](#-usage)
- [Examples](#-examples)
- [Architecture](#-architecture)
- [MCP Tools](#-mcp-tools)
---

## 🔧 Prerequisites

### Required Software
- [Python 3.12+](https://www.python.org/downloads/)
- [kubectl](https://kubernetes.io/docs/tasks/tools/)
- Access to a running **Kubernetes cluster**
- **AWS account** with Bedrock API access

### AWS Bedrock Setup
1. Enable Claude models in the AWS Bedrock console  
2. Configure AWS credentials with Bedrock access  
3. Ensure IAM permissions for `bedrock:InvokeModel`  

---

## 📦 Installation

### Quick Setup

```bash
# 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.py
```

---

## ⚙️ Configuration

### Environment Variables

Set or export the following variables before running the agent:

```bash
# 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-1
```

---

## 🎯 Usage

### Start the Agent

```bash
python3 agent.py
```

### Example Interactive Commands

```bash
⎈ 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
```

---

## 💡 Examples

### List Pods

```bash
⎈ kubectl> show all pods in the cluster
```
**AI 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
```

### Troubleshoot a Pod

```bash
⎈ 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
```

### View Logs

```bash
⎈ kubectl> get the last 50 lines of logs from nginx pod and summarize
```

### Manage Contexts

```bash
⎈ kubectl> list all available clusters
⎈ kubectl> switch to production-cluster
⎈ kubectl> what's my current context?
```

### Scale Deployments

```bash
⎈ kubectl> scale nginx deployment to 5 replicas
```

### Namespace Operations

```bash
⎈ kubectl> show all resources in kube-system namespace
⎈ kubectl> get all deployments across all namespaces
```

---

## 🏗️ Architecture

### System Components

---

## 🧩 MCP Tools

### run_kubectl_command

```python
{
  "command": "kubectl get pods -n default -o json",
  "return_code": 0,
  "stdout": "...",
  "success": true
}
```

### kubectl_context

```python
{
  "action": "list",
  "success": true,
  "output": "..."
}
```

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Tarique-B-DevOps](https://github.com/Tarique-B-DevOps)
- **Source:** [Tarique-B-DevOps/Agentic-Kubernetes-CLI](https://github.com/Tarique-B-DevOps/Agentic-Kubernetes-CLI)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-tarique-b-devops-agentic-kubernetes-cli
- Seller: https://agentstack.voostack.com/s/tarique-b-devops
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
