能做什么
Read-only Kubernetes diagnostics: pods, logs, events, workloads, services, PVCs and nodes.
作者提供的原文
- 连接方式 在你的电脑上运行
- 账号或密钥 无需密钥 · 需填写 2 项设置(KUBECONFIG, ALLOWED_NAMESPACES)
- 分类 开发者工具
可搭配使用
教 AI 做这类工作的 Skill,可与本项一起使用
andrej-karpathy-skills
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
graphify
Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and Gemini CLI: local deterministic AST parsing, every edge explained, no vector store.
为什么排在这里
列表按使用分(满分 100)排序,由以下部分组成
| 热度 | 0/80 | GitHub 星标或每周下载量:较大的计 60,较小的计 20 |
|---|---|---|
| 新鲜度 | 7/12 | 30 天内有发布或代码更新得满分 |
| 仍在响应 | 0/8 | 上次检查时云端端点有响应 |
| 使用分 | 7/100 |
质量: 基础检查通过 3/3 项(仅展示,不用于排序) · 上升势头: 暂无数据 (只用于“上升中”标签)
安装
选择你使用的 AI 应用,然后复制设置。
通过 3/3 项检查 · 在你的电脑上运行
第一步:你用哪个 AI?
选择你用的应用,步骤会显示在下方。
可连接 Claude,但需要先准备
需要填写 2 项设置(KUBECONFIG, ALLOWED_NAMESPACES) · 需要先在电脑上安装 Docker(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
安装 Docker(如果还没有)
已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter
docker --version- 显示版本号(例如 Docker version …)= 已安装,可跳过这一步
- 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
怎么打开终端
Mac:按 ⌘ + Space,输入 Terminal 后按 Enter
Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”
还没安装: 安装 Docker Desktop:Mac 打开 Docker.dmg,把图标拖到“应用程序”(按电脑选择 Apple silicon 或 Intel 版本)· Windows 双击 Docker Desktop Installer.exe · 装好后打开 Docker Desktop 应用并保持运行。不需要 curl 命令
装好后关掉终端再打开,重新运行同一条命令,应显示版本号:
docker --version安装一次,所有需要 Docker 的工具都能用
填写 2 项设置
这些是程序设置,不是密钥,无需注册。按开发者的说明填写。
KUBECONFIG容器内 kubeconfig 文件的路径。必须与挂载目标一致。不会回退到 /.kube/config,也不使用集群内配置:文件缺失、不可读或格式错误都会导致启动失败。· 默认值 /kubeconfig查看英文原文
Path to the kubeconfig inside the container. Must match the mount destination. There is no fallback to ~/.kube/config and no in-cluster config: a missing, unreadable or malformed file is a startup fa…ALLOWED_NAMESPACES服务器可读取的逗号分隔命名空间,例如 staging,production。启动时会拒绝通配符( 和 all),即使列出,kube-system 和 kube-public 也会被剔除。这属于纵深防御。查看英文原文
Comma-separated namespaces the server may read, e.g. staging,production. Wildcards (* and all) are rejected at startup, and kube-system and kube-public are stripped even if listed. This is defense-in…
说明为自动翻译,变量名保持原样;不确定时请查看原文。
打开电脑版 Claude 应用的设置文件
SettingsDeveloperEdit Config
粘贴这些设置并保存文件
正在检查命令 · 通过后才会显示复制按钮
退出 Claude 再重新打开
试一试
用 Kubernetes Troubleshoot 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude 说正在使用 Kubernetes Troubleshoot,或回答中出现 Kubernetes Troubleshoot 的工具名称,就表示连接成功
3 项可选设置(不填也能用)
上面的命令不填这些也能用。想调整时再按开发者的说明添加。
LOG_LEVELDEBUG、INFO、WARNING 或 ERROR。所有日志都输出到 stderr;stdout 专用于 JSON-RPC 流。· 默认值 INFO查看英文原文
DEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively.API_TIMEOUT_SECONDSKubernetes API 请求超时时间。必须为正整数。· 默认值 30查看英文原文
Kubernetes API request timeout. Must be a positive integer.MAX_LOG_LINES单次 get_pod_logs 调用可返回的最大日志行数。必须为正整数;会被限制在 1000 的硬上限并给出警告。· 默认值 200查看英文原文
Maximum log lines any single get_pod_logs call may return. Must be a positive integer; clamped to a hard ceiling of 1000 with a warning.
说明为自动翻译,变量名保持原样;不确定时请查看原文。
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
ChatGPT 暂时无法连接 Kubernetes Troubleshoot
Kubernetes Troubleshoot 需要安装在你的电脑上,而 ChatGPT 只能连接在网上运行的服务器
你可以改用这些方式
A · 使用能连接 Kubernetes Troubleshoot 的应用
- 需要填写 2 项设置(KUBECONFIG, ALLOWED_NAMESPACES) · 需要先在电脑上安装 Docker(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
- 需要填写 2 项设置(KUBECONFIG, ALLOWED_NAMESPACES) · 需要先在电脑上安装 Docker(只需一次)
- 需要填写 2 项设置(KUBECONFIG, ALLOWED_NAMESPACES) · 需要先在电脑上安装 Docker(只需一次)
- 需要填写 2 项设置(KUBECONFIG, ALLOWED_NAMESPACES) · 需要先在电脑上安装 Docker(只需一次)
B · 开发者工具 类中能连接 ChatGPT 的其他服务器
从同类中使用较多的里挑选,仅限用地址即可连接、无需密钥的
- Sentry✓ ChatGPT
- Compiler Explorer✓ ChatGPT
- GitDiagram✓ ChatGPT
可连接 Claude Code,但需要先准备
需要填写 2 项设置(KUBECONFIG, ALLOWED_NAMESPACES) · 需要先在电脑上安装 Docker(只需一次)
安装 Docker(如果还没有)
已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter
docker --version- 显示版本号(例如 Docker version …)= 已安装,可跳过这一步
- 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
怎么打开终端
Mac:按 ⌘ + Space,输入 Terminal 后按 Enter
Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”
还没安装: 安装 Docker Desktop:Mac 打开 Docker.dmg,把图标拖到“应用程序”(按电脑选择 Apple silicon 或 Intel 版本)· Windows 双击 Docker Desktop Installer.exe · 装好后打开 Docker Desktop 应用并保持运行。不需要 curl 命令
装好后关掉终端再打开,重新运行同一条命令,应显示版本号:
docker --version安装一次,所有需要 Docker 的工具都能用
填写 2 项设置
这些是程序设置,不是密钥,无需注册。按开发者的说明填写。
KUBECONFIG容器内 kubeconfig 文件的路径。必须与挂载目标一致。不会回退到 /.kube/config,也不使用集群内配置:文件缺失、不可读或格式错误都会导致启动失败。· 默认值 /kubeconfig查看英文原文
Path to the kubeconfig inside the container. Must match the mount destination. There is no fallback to ~/.kube/config and no in-cluster config: a missing, unreadable or malformed file is a startup fa…ALLOWED_NAMESPACES服务器可读取的逗号分隔命名空间,例如 staging,production。启动时会拒绝通配符( 和 all),即使列出,kube-system 和 kube-public 也会被剔除。这属于纵深防御。查看英文原文
Comma-separated namespaces the server may read, e.g. staging,production. Wildcards (* and all) are rejected at startup, and kube-system and kube-public are stripped even if listed. This is defense-in…
说明为自动翻译,变量名保持原样;不确定时请查看原文。
打开终端
Mac:按 Command+空格,输入 Terminal · Windows:打开 PowerShell
粘贴这条命令并按 Enter
正在检查命令 · 通过后才会显示复制按钮
在 Claude Code 中输入 /mcp
应能看到 Kubernetes Troubleshoot 在列表中并显示已连接
试一试
用 Kubernetes Troubleshoot 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude Code 说正在使用 Kubernetes Troubleshoot,或回答中出现 Kubernetes Troubleshoot 的工具名称,就表示连接成功
3 项可选设置(不填也能用)
上面的命令不填这些也能用。想调整时再按开发者的说明添加。
LOG_LEVELDEBUG、INFO、WARNING 或 ERROR。所有日志都输出到 stderr;stdout 专用于 JSON-RPC 流。· 默认值 INFO查看英文原文
DEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively.API_TIMEOUT_SECONDSKubernetes API 请求超时时间。必须为正整数。· 默认值 30查看英文原文
Kubernetes API request timeout. Must be a positive integer.MAX_LOG_LINES单次 get_pod_logs 调用可返回的最大日志行数。必须为正整数;会被限制在 1000 的硬上限并给出警告。· 默认值 200查看英文原文
Maximum log lines any single get_pod_logs call may return. Must be a positive integer; clamped to a hard ceiling of 1000 with a warning.
说明为自动翻译,变量名保持原样;不确定时请查看原文。
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
可连接 Cursor,但需要先准备
需要填写 2 项设置(KUBECONFIG, ALLOWED_NAMESPACES) · 需要先在电脑上安装 Docker(只需一次)
安装 Docker(如果还没有)
已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter
docker --version- 显示版本号(例如 Docker version …)= 已安装,可跳过这一步
- 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
怎么打开终端
Mac:按 ⌘ + Space,输入 Terminal 后按 Enter
Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”
还没安装: 安装 Docker Desktop:Mac 打开 Docker.dmg,把图标拖到“应用程序”(按电脑选择 Apple silicon 或 Intel 版本)· Windows 双击 Docker Desktop Installer.exe · 装好后打开 Docker Desktop 应用并保持运行。不需要 curl 命令
装好后关掉终端再打开,重新运行同一条命令,应显示版本号:
docker --version安装一次,所有需要 Docker 的工具都能用
填写 2 项设置
这些是程序设置,不是密钥,无需注册。按开发者的说明填写。
KUBECONFIG容器内 kubeconfig 文件的路径。必须与挂载目标一致。不会回退到 /.kube/config,也不使用集群内配置:文件缺失、不可读或格式错误都会导致启动失败。· 默认值 /kubeconfig查看英文原文
Path to the kubeconfig inside the container. Must match the mount destination. There is no fallback to ~/.kube/config and no in-cluster config: a missing, unreadable or malformed file is a startup fa…ALLOWED_NAMESPACES服务器可读取的逗号分隔命名空间,例如 staging,production。启动时会拒绝通配符( 和 all),即使列出,kube-system 和 kube-public 也会被剔除。这属于纵深防御。查看英文原文
Comma-separated namespaces the server may read, e.g. staging,production. Wildcards (* and all) are rejected at startup, and kube-system and kube-public are stripped even if listed. This is defense-in…
说明为自动翻译,变量名保持原样;不确定时请查看原文。
点击这个按钮打开 Cursor
正在检查命令 · 通过后才会显示复制按钮
填写你的密钥
在 Kubernetes Troubleshoot 的设置中,KUBECONFIG, ALLOWED_NAMESPACES 还是空的,填入你的密钥并保存
在 Cursor 中以 Agent 模式打开 AI 聊天
试一试
用 Kubernetes Troubleshoot 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Cursor 说正在使用 Kubernetes Troubleshoot,或回答中出现 Kubernetes Troubleshoot 的工具名称,就表示连接成功
3 项可选设置(不填也能用)
上面的命令不填这些也能用。想调整时再按开发者的说明添加。
LOG_LEVELDEBUG、INFO、WARNING 或 ERROR。所有日志都输出到 stderr;stdout 专用于 JSON-RPC 流。· 默认值 INFO查看英文原文
DEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively.API_TIMEOUT_SECONDSKubernetes API 请求超时时间。必须为正整数。· 默认值 30查看英文原文
Kubernetes API request timeout. Must be a positive integer.MAX_LOG_LINES单次 get_pod_logs 调用可返回的最大日志行数。必须为正整数;会被限制在 1000 的硬上限并给出警告。· 默认值 200查看英文原文
Maximum log lines any single get_pod_logs call may return. Must be a positive integer; clamped to a hard ceiling of 1000 with a warning.
说明为自动翻译,变量名保持原样;不确定时请查看原文。
菜单名称已于 2026年11月11日 对照 Cursor 帮助页面核实 · 你的界面可能因版本略有不同
可连接 VS Code,但需要先准备
需要填写 2 项设置(KUBECONFIG, ALLOWED_NAMESPACES) · 需要先在电脑上安装 Docker(只需一次)
安装 Docker(如果还没有)
已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter
docker --version- 显示版本号(例如 Docker version …)= 已安装,可跳过这一步
- 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
怎么打开终端
Mac:按 ⌘ + Space,输入 Terminal 后按 Enter
Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”
还没安装: 安装 Docker Desktop:Mac 打开 Docker.dmg,把图标拖到“应用程序”(按电脑选择 Apple silicon 或 Intel 版本)· Windows 双击 Docker Desktop Installer.exe · 装好后打开 Docker Desktop 应用并保持运行。不需要 curl 命令
装好后关掉终端再打开,重新运行同一条命令,应显示版本号:
docker --version安装一次,所有需要 Docker 的工具都能用
填写 2 项设置
这些是程序设置,不是密钥,无需注册。按开发者的说明填写。
KUBECONFIG容器内 kubeconfig 文件的路径。必须与挂载目标一致。不会回退到 /.kube/config,也不使用集群内配置:文件缺失、不可读或格式错误都会导致启动失败。· 默认值 /kubeconfig查看英文原文
Path to the kubeconfig inside the container. Must match the mount destination. There is no fallback to ~/.kube/config and no in-cluster config: a missing, unreadable or malformed file is a startup fa…ALLOWED_NAMESPACES服务器可读取的逗号分隔命名空间,例如 staging,production。启动时会拒绝通配符( 和 all),即使列出,kube-system 和 kube-public 也会被剔除。这属于纵深防御。查看英文原文
Comma-separated namespaces the server may read, e.g. staging,production. Wildcards (* and all) are rejected at startup, and kube-system and kube-public are stripped even if listed. This is defense-in…
说明为自动翻译,变量名保持原样;不确定时请查看原文。
点击这个按钮打开 VS Code
正在检查命令 · 通过后才会显示复制按钮
填写你的密钥
在 Kubernetes Troubleshoot 的设置中,KUBECONFIG, ALLOWED_NAMESPACES 还是空的,填入你的密钥并保存
在 VS Code 中以 Agent 模式打开 AI 聊天
试一试
用 Kubernetes Troubleshoot 告诉我你能帮我做什么,然后做一件给我看✓ 如果 VS Code 说正在使用 Kubernetes Troubleshoot,或回答中出现 Kubernetes Troubleshoot 的工具名称,就表示连接成功
3 项可选设置(不填也能用)
上面的命令不填这些也能用。想调整时再按开发者的说明添加。
LOG_LEVELDEBUG、INFO、WARNING 或 ERROR。所有日志都输出到 stderr;stdout 专用于 JSON-RPC 流。· 默认值 INFO查看英文原文
DEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively.API_TIMEOUT_SECONDSKubernetes API 请求超时时间。必须为正整数。· 默认值 30查看英文原文
Kubernetes API request timeout. Must be a positive integer.MAX_LOG_LINES单次 get_pod_logs 调用可返回的最大日志行数。必须为正整数;会被限制在 1000 的硬上限并给出警告。· 默认值 200查看英文原文
Maximum log lines any single get_pod_logs call may return. Must be a positive integer; clamped to a hard ceiling of 1000 with a warning.
说明为自动翻译,变量名保持原样;不确定时请查看原文。
菜单名称已于 2026年11月11日 对照 VS Code 帮助页面核实 · 你的界面可能因版本略有不同
开发者专用:终端命令和 JSON 设置
安装在电脑上
Claude Code
正在检查命令 · 通过后才会显示复制按钮
Claude Desktop (claude_desktop_config.json)
正在检查命令 · 通过后才会显示复制按钮
Cursor (~/.cursor/mcp.json)
正在检查命令 · 通过后才会显示复制按钮
VS Code (mcp.json)
正在检查命令 · 通过后才会显示复制按钮
需要你填写的值
KUBECONFIG必填 env容器内 kubeconfig 文件的路径。必须与挂载目标一致。不会回退到 /.kube/config,也不使用集群内配置:文件缺失、不可读或格式错误都会导致启动失败。查看英文原文
Path to the kubeconfig inside the container. Must match the mount destination. There is no fallback to ~/.kube/config and no in-cluster config: a missing, unreadable or malformed file is a startup fa…ALLOWED_NAMESPACES必填 env服务器可读取的逗号分隔命名空间,例如 staging,production。启动时会拒绝通配符( 和 all),即使列出,kube-system 和 kube-public 也会被剔除。这属于纵深防御。查看英文原文
Comma-separated namespaces the server may read, e.g. staging,production. Wildcards (* and all) are rejected at startup, and kube-system and kube-public are stripped even if listed. This is defense-in…LOG_LEVELenvDEBUG、INFO、WARNING 或 ERROR。所有日志都输出到 stderr;stdout 专用于 JSON-RPC 流。查看英文原文
DEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively.API_TIMEOUT_SECONDSenvKubernetes API 请求超时时间。必须为正整数。查看英文原文
Kubernetes API request timeout. Must be a positive integer.MAX_LOG_LINESenv单次 get_pod_logs 调用可返回的最大日志行数。必须为正整数;会被限制在 1000 的硬上限并给出警告。查看英文原文
Maximum log lines any single get_pod_logs call may return. Must be a positive integer; clamped to a hard ceiling of 1000 with a warning.
说明为自动翻译,变量名保持原样;不确定时请查看原文。
这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。
一览
哪些应用可以使用它
依据这个服务器的连接方式和各应用自己的文档,检查于 2026年11月10日。
在你的电脑上运行,适用于
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
它能做什么
它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。
基础检查i
我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月20日
- ✓ 通过
作者与仓库一致
注册名称已通过 GitHub 账户 NanaGyamfiPrempeh30 验证,该账户拥有此仓库
- ✓ 通过
仍在维护
代码最后更新于3个月前
- ✓ 通过
有许可证
使用 MIT
- – 不适用
端点有响应
它在你的电脑上运行,没有互联网端点
- – 不适用
使用 OAuth 登录
在你的电脑上运行,改用本地设置
- … 尚未检查
工具描述中没有隐藏指令
它在你的电脑上运行;我们只能读取互联网端点的工具列表
作者:申请重新检查或报告信息错误
给作者:在 README 中加徽章
如果你是作者,可把这段代码贴到 README。徽章会链接回本页。
[](https://mcp.popnx.com/en/servers/nanagyamfiprempeh30-k8s-troubleshoot-mcp)讨论
提问、分享技巧或报告无法使用。按“有帮助”数量排序。
用户评价
还没有评价
与“开发者工具”中的其他服务器比较i
- 星标数多于此分类中其他 6209 个服务器的 0%
- 发布到注册中心的时间比此分类中其他 6209 个服务器的 28% 更新
- 基础检查结果等于或优于此分类中其他 6209 个服务器的 99%
与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。
常见问题
Kubernetes Troubleshoot 安全吗?
它在 3 项适用的基础检查中通过了 3 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。
它需要哪些密钥或代码?
注册中心没有列出必需的密钥,不过有些服务器会在首次使用时要求你登录。
它在我的电脑上运行还是在云端?
它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。
它还在维护吗?
GitHub 仓库最后更新于3个月前,最新版本(1.0.0)于3个月前进入注册中心。
哪些应用可以使用它?
支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Docker。
有什么可以替代它?
同一分类中有:GitDiagram, Appllama, Cloudflare MCP, Omnara, Repowise
功能相近的其他选择
同一分类、其他作者、命令已通过检查。官方的排在前面,再按星标排序。
如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i
GitDiagram
Architecture diagrams, explanations and Mermaid source for public GitHub repositories.
Appllama
Study screens, flows and paywalls from top-earning iOS apps, then build from what wins.
Omnara
Deploy durable AI agents with Omnara, an open-source managed-agent platform.
Repowise
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
| 本项 Kubernetes Troubleshoot | GitDiagram | Appllama | Cloudflare MCP | Omnara | Repowise | |
|---|---|---|---|---|---|---|
| 运行位置 | 需要安装在电脑上 | 在云端运行,无需安装 | 在云端运行,无需安装 | 在云端运行,无需安装 | 在云端运行,无需安装 | 云端或安装在电脑上都可以 |
| 需要密钥 | 否 | 否 | 否 | 否 | 否 | 否 |
| 可在 Claude 中按 + 添加 | 否 | 否 | 否 | 是 | 否 | 否 |
| 基础检查 | 3/3 | 4/4 | 4/4 | 4/4 | 4/4 | 5/5 |
| 许可证 | MIT | MIT | MIT | Apache-2.0 | Apache-2.0 | AGPL-3.0 |
| 价格 | 登记中未列出费用 | 登记中未列出费用 | 登记中未列出费用 | 登记中未列出费用 | 登记中未列出费用 | 登记中未列出费用 |
作者的 README
打开 README
按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。
k8s-troubleshoot-mcp
A read-only MCP (Model Context Protocol) server that lets an AI assistant diagnose a Kubernetes cluster. Ask why a pod is crash-looping instead of running six kubectl commands and correlating the output by hand.
Read-only is a structural property, not a promise. There are no write tools, and the RBAC manifests grant no write verbs. See Security model.
What It Does
The server exposes 16 diagnostic tools over stdio. Connect it to Claude Desktop, VS Code, or Kiro, and you can ask things like:
- "Why is the
checkoutpod instagingnot ready?" - "Show me the last 50 lines of logs from the
apicontainer" - "Which nodes are not Ready, and what are their taints?"
- "Is the
webHPA scaling, and what does its current metric say?" - "What events fired in
productionin the last few minutes?"
The assistant calls the tools, the server queries the Kubernetes API with a scoped ServiceAccount token, and every response comes back as a structured dict — including errors, which are never raised as exceptions into the MCP layer.
Architecture
┌──────────────────┐ stdio (JSON-RPC) ┌──────────────────────────┐
│ MCP Client │◄─────────────────────►│ MCP Server │ │ Claude Desktop │ │ (this project) │ │ VS Code / Kiro │ │ │ └──────────────────┘ │ config.py ─ validate │ │ server.py ─ 16 tools │ │ tools/*.py ─ read+shape│ │ response.py ─ escape + │ │ structure │ └───────────┬──────────────┘ │ HTTPS, explicit │ KUBECONFIG only ┌───────────▼──────────────┐ │ Kubernetes API server │ │ ── RBAC boundary ── │ │ ServiceAccount: │ │ get/list/watch only │ └──────────────────────────┘
Configuration is validated once at startup. If anything is wrong — KUBECONFIG unset, the file unreadable or malformed, ALLOWED_NAMESPACES missing or containing a wildcard — the process writes one line to stderr and exits 1. It never starts in a partially-valid state.
Available Tools
Arguments marked ? are optional.
| Tool | Description | Parameters |
|---|---|---|
get_pod_status | Phase, conditions, container statuses, QoS class and node for a pod | pod_name, namespace |
get_pod_logs | Recent log lines from a pod container. Content is untrusted — see Reading get_pod_logs output | pod_name, namespace, container?, previous?, tail_lines? |
get_pod_events | Recent events for a pod, newest first, with total_available | pod_name, namespace |
list_pods | Pods in a namespace with phase, restart count and readiness | namespace, label_selector? |
get_node_status | Conditions, capacity, allocatable, taints and roles for a node | node_name |
list_nodes | Cluster nodes with readiness, roles, age and kubelet version | none |
get_deployment_status | Replica counts, conditions and rollout strategy | deployment_name, namespace |
list_deployments | Deployments in a namespace with replica counts and availability | namespace |
get_statefulset_status | Replica counts, revisions and update strategy | statefulset_name, namespace |
get_daemonset_status | Scheduling counts and update strategy | daemonset_name, namespace |
get_service | Type, ClusterIP, ports, selector and ready endpoint count | service_name, namespace |
get_endpoints | Ready and not-ready endpoint addresses backing a service | service_name, namespace |
get_pvc_status | Phase, capacity, binding and resize state for a PVC | pvc_name, namespace |
get_hpa_status | Replica bounds, current metrics and conditions for an HPA | hpa_name, namespace |
get_namespace_events | Recent events across a namespace, newest first, with total_available | namespace, limit? |
list_namespaces | The namespaces this server is permitted to read | none |
Every namespaced tool validates its namespace argument before making any API call, so a disallowed namespace produces a structured error and no network request.
Deliberately absent
No get_secrets, get_configmap, exec_into_pod, port_forward, or any create/update/patch/delete tool. These are excluded from all versions unless a new threat-model review is conducted and documented — they are not backlog items. The reasoning for each is in SECURITY.md.
Security model
Full detail is in SECURITY.md. The summary:
The boundary is Kubernetes RBAC
Everything this server does in application code is defense-in-depth. The enforcement boundary is the ServiceAccount's RBAC bindings. If the bindings grant more than intended, the application-layer allowlist is all that stands in the way, and it is not a boundary you should rely on.
Provisioning is split by scope so that the cluster-scoped grant is minimal:
| Manifest | Scope | Grants |
|---|---|---|
clusterrole.yaml + clusterrolebinding.yaml | cluster | get/list/watch on nodes and namespaces only |
role.yaml | namespace | get/list/watch on the diagnostic resources |
rolebinding.yaml.template | namespace | binds the Role, one namespace at a time |
Applying the cluster-scoped pair makes no namespace readable. A namespace becomes readable only when a Role *and* a RoleBinding exist in it. A namespace listed in ALLOWED_NAMESPACES but never bound stays unreadable — RBAC wins.
pods/log is granted in its own rule block, never folded into the pods rule, because Kubernetes subresources do not inherit from their parent.
Defense-in-depth layers
| Layer | What it does | What it is not |
|---|---|---|
| RBAC | Grants read verbs on diagnostic resources in bound namespaces only | — this *is* the boundary |
| Explicit kubeconfig | Reads KUBECONFIG from an exact path; no ~/.kube/config, no in-cluster config, no fallback chain | Not a permission check — it prevents silently picking up an ambient credential |
| Namespace allowlist | Rejects wildcards, strips kube-system/kube-public, validates before every call | Advisory; a bug here is contained by RBAC |
| Output escaping | All cluster-authored free text routed through serialize_log_content | Prevents breaking out of a JSON string; cannot stop a model acting on legible instructions |
| Structured errors | Every failure returns a dict; no exception reaches the MCP layer | — |
Prompt injection is mitigated, not eliminated
Pod logs and event messages are written by workloads in the cluster. A container can print anything, including text shaped like instructions to the model reading it. Escaping keeps injected text inside its JSON string; it cannot stop a model from acting on instructions it reads as data. Treat tool output as untrusted input to whatever consumes it. This residual risk is accepted and documented.
Prerequisites
- A Kubernetes cluster and a
kubectlcontext with enough permission to create a ServiceAccount, Role, RoleBinding, ClusterRole and ClusterRoleBinding — you need this once, to provision. The server itself never uses your admin credential. - Kubernetes 1.24+ —
scripts/generate-kubeconfig.shmints a token via the TokenRequest API, not a legacy auto-mounted Secret. - Python 3.11+
- uv —
curl -LsSf https://astral.sh/uv/install.sh | sh(or use Docker, which needs neither Python nor uv on the host)
Setup
git clone https://github.com/NanaGyamfiPrempeh30/k8s-troubleshoot-mcp.git
cd k8s-troubleshoot-mcp
Install dependencies (uv creates .venv automatically)
uv sync
Run the test suite
uv run pytest tests/ -q
Provision RBAC and mint a kubeconfig
scripts/generate-kubeconfig.sh /secure/path/k8s-mcp-kubeconfig.yaml staging production
The first argument is where to write the kubeconfig; the rest are the namespaces the server may read. Pass the same set you intend to put in ALLOWED_NAMESPACES — RBAC is the enforcement boundary, and a namespace bound here but absent from the allowlist (or the reverse) is a mismatch between real permission and configured capability.
The script applies the cluster-scoped manifests together, then applies role.yaml with an explicit -n and renders a RoleBinding per namespace. On success it prints the kubeconfig path to stdout and nothing else; all diagnostics go to stderr. It also asserts after provisioning that kubectl auth can-i get secrets returns no, and aborts if it does not.
Do not run `kubectl apply -f kubernetes/`. It does not fail — it reports
success while creating
role.yamlin the *current* namespace and skipping
rolebinding.yaml.templateentirely, becausekubectl apply -fonly
reads
.yaml/.yml/.json. The result is a server that looks provisioned
and can read nothing. Verified against a v1.35 API server with
--dry-run=server: 5 resources applied, not 6.
The generated kubeconfig is written with umask 077 and chmod 600. Keep it out of the repository — the script warns if the output path is inside a repository and not covered by .gitignore.
Run it
KUBECONFIG=/secure/path/k8s-mcp-kubeconfig.yaml \
ALLOWED_NAMESPACES=staging,production \ uv run k8s-troubleshoot-mcp
The server speaks JSON-RPC on stdin/stdout, so it will appear to hang — that is correct. It is waiting for a client.
Connecting to Claude Desktop
Add to claude_desktop_config.json (%APPDATA%\Claude\claude_desktop_config.json on Windows, ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": { "k8s-troubleshoot": { "command": "uv", "args": ["run", "k8s-troubleshoot-mcp"], "cwd": "/path/to/k8s-troubleshoot-mcp", "env": { "KUBECONFIG": "/secure/path/k8s-mcp-kubeconfig.yaml", "ALLOWED_NAMESPACES": "staging,production" } } } }
Restart Claude Desktop fully (quit from the system tray, reopen), then check Settings → Developer → k8s-troubleshoot shows running.
On Windows, if the server shows as disconnected, use a batch file wrapper — Claude Desktop has working-directory issues with direct interpreter invocation:
@echo off
cd /d C:\Users\YourUsername\k8s-troubleshoot-mcp uv run k8s-troubleshoot-mcp
{
"mcpServers": { "k8s-troubleshoot": { "command": "cmd.exe", "args": ["/c", "C:\\Users\\YourUsername\\k8s-troubleshoot-mcp\\run_mcp.bat"], "env": { "KUBECONFIG": "C:\\secure\\path\\k8s-mcp-kubeconfig.yaml", "ALLOWED_NAMESPACES": "staging,production" } } } }
Running with Docker
docker build -t k8s-troubleshoot-mcp .
docker run -i --rm \ -v /secure/path/k8s-mcp-kubeconfig.yaml:/kubeconfig:ro \ -e KUBECONFIG=/kubeconfig \ -e ALLOWED_NAMESPACES=staging,production \ k8s-troubleshoot-mcp
-i is required — JSON-RPC travels on stdin/stdout. :ro is not decoration: this server performs no writes of any kind, so a writable mount would grant privilege it has no use for.
The image runs as non-root, UID 10001, and contains no c