Claude Code Integration

Use Claude Code’s AI capabilities to manage multiple Kubernetes clusters simultaneously with natural language.

Overview

klaude is an AI-powered kubectl plugin designed for managing multiple clusters simultaneously. It integrates with Claude Code, enabling you to:

  • Query Kubernetes resources across multiple clusters using natural language
  • Diagnose pod issues (CrashLoopBackOff, OOMKilled, pending pods)
  • Analyze RBAC permissions for any subject
  • Detect security misconfigurations
  • Monitor events and cluster health

Installation

brew tap kubestellar/tap
brew install klaude

Option 2: Claude Code Plugin Marketplace

In Claude Code, run:

/plugin marketplace add kubestellar/claude-plugins

Then go to /pluginDiscover tab and install klaude.

Verify Installation

Run /mcp in Claude Code to see connected MCP servers:

plugin:klaude:klaude · ✓ connected

Configuration

Allow Tools Without Prompts

To avoid permission prompts for each tool call, add to ~/.claude/settings.json:

{
  "permissions": {
    "allow": [
      "mcp__plugin_klaude_klaude__*"
    ]
  }
}

Or run in Claude Code:

/allowed-tools add mcp__plugin_klaude_klaude__*

Slash Commands

The klaude plugin provides specialized slash commands for common Kubernetes operations:

/k8s-health

Check the health of all Kubernetes clusters in your kubeconfig.

/k8s-health

This will:

  1. Discover all available clusters
  2. Check health status of each cluster
  3. Summarize any issues with recommended actions

/k8s-issues

Find all issues across your Kubernetes clusters.

/k8s-issues

Checks for:

  • Pod issues (CrashLoopBackOff, ImagePullBackOff, OOMKilled, pending)
  • Deployment issues (stuck rollouts, unavailable replicas)
  • Warning events

/k8s-analyze

Perform a comprehensive analysis of a Kubernetes namespace.

/k8s-analyze

Provides insights on:

  • Workload health (pods, deployments)
  • Resource usage and limits
  • Potential issues and recommendations

/k8s-rbac

Analyze RBAC permissions for any subject (user, group, or service account).

/k8s-rbac

Shows:

  • All RoleBindings and ClusterRoleBindings
  • Effective permissions
  • Overly permissive access warnings
  • Security recommendations

/k8s-security

Perform a security audit across all clusters.

/k8s-security

Finds:

  • Privileged containers
  • Containers running as root
  • Host network/PID/IPC usage
  • Pods without resource limits
  • Security misconfigurations

/k8s-audit-kubeconfig

Audit your kubeconfig and clean up stale clusters.

/k8s-audit-kubeconfig

Shows:

  • Which clusters are accessible (with versions)
  • Which clusters are inaccessible
  • Cleanup commands for stale configurations

Usage Examples installed, ask Claude questions like:

Cluster Management

  • “List my Kubernetes clusters”
  • “Check cluster health”
  • “Show me nodes in the production cluster”
  • “Audit my kubeconfig for stale clusters”

Workload Diagnostics

  • “Find pods with issues in the production namespace”
  • “Show me CrashLoopBackOff pods”
  • “What’s wrong with the frontend deployment?”
  • “Get logs from the api-server pod”

RBAC Analysis

  • “What permissions does the admin service account have?”
  • “Can I create deployments in the default namespace?”
  • “Show me all cluster roles”
  • “Analyze RBAC for user john@example.com

Security

  • “Check for security misconfigurations in my cluster”
  • “Find pods running as root”
  • “Show me containers with privileged access”
  • “Check resource limits across namespaces”

Events and Monitoring

  • “Show me warning events in kube-system”
  • “What events happened in the last hour?”
  • “Analyze the production namespace”

Available Tools

Cluster Tools

ToolDescription
list_clustersDiscover clusters from kubeconfig
get_cluster_healthCheck cluster health status
get_nodesList cluster nodes with status
audit_kubeconfigAudit all clusters for connectivity

Workload Tools

ToolDescription
get_podsList pods with filtering options
get_deploymentsList deployments
get_servicesList services
get_eventsGet recent events
describe_podGet detailed pod information
get_pod_logsRetrieve pod logs

RBAC Tools

ToolDescription
get_rolesList Roles in a namespace
get_cluster_rolesList ClusterRoles
get_role_bindingsList RoleBindings
get_cluster_role_bindingsList ClusterRoleBindings
can_iCheck if you can perform an action
analyze_subject_permissionsFull RBAC analysis for any subject
describe_roleDetailed view of Role/ClusterRole rules

Diagnostic Tools

ToolDescription
find_pod_issuesFind CrashLoopBackOff, OOMKilled, pending pods
find_deployment_issuesFind stuck rollouts, unavailable replicas
check_resource_limitsFind pods without CPU/memory limits
check_security_issuesFind privileged containers, root users
analyze_namespaceComprehensive namespace analysis
get_warning_eventsGet Warning events

CLI Usage

klaude also works as a standalone kubectl plugin:

# List all clusters
kubectl klaude clusters list
 
# Check cluster health
kubectl klaude clusters health
 
# Natural language queries (requires ANTHROPIC_API_KEY)
kubectl klaude "show me failing pods"