Follow the K8sGPT installation guide: https://docs.k8sgpt.ai/getting-started/installation/
After K8sGPT installation, first check if it's working by using k8sgpt analyze. If it shows results, apply the commands below to start MCP support with Claude.
mkdir -p ~/Library/Application\ Support/Claudecat > ~/Library/Application\ Support/Claude/claude_desktop_config.json << EOF
{
"mcpServers": {
"k8sgpt": {
"command": "k8sgpt",
"args": ["serve", "--mcp", "--port", "3333"],
"env": {
"KUBECONFIG": "/Users/\$(whoami)/.kube/config"
}
}
}
}
EOFsed -i '' "s/\\\$USER/\$USER/g" ~/Library/Application\ Support/Claude/claude_desktop_config.jsoncat ~/Library/Application\ Support/Claude/claude_desktop_config.jsonOnce configuration is complete:
- Restart Claude Desktop
- Start chatting about your Kubernetes cluster
- Claude will now have access to K8sGPT analysis capabilities
- Ensure K8sGPT is properly installed and
k8sgpt analyzeworks before configuring MCP - Verify your
KUBECONFIGpath is correct - Check that port 3333 is available
- Restart Claude Desktop after making configuration changes