/ 디렉터리 / 플레이그라운드 / k8s-mcp-server
● 커뮤니티 alexei-led ⚡ 바로 사용

k8s-mcp-server

제작: alexei-led · alexei-led/k8s-mcp-server

Give Claude kubectl, helm, istioctl, and argocd — with command validation, non-root execution, and scoped kubeconfig — so you can ops your cluster by chat.

k8s-mcp-server runs as a Docker container that mounts your kubeconfig read-only. It wraps kubectl/helm/istioctl/argocd plus Unix utilities (jq, grep, sed) for pipelines. Two security modes (default restrictive, permissive) and a command validator so Claude can't accidentally kubectl delete namespace your prod.

왜 쓰나요

핵심 기능

라이브 데모

실제 사용 모습

k8s.replay ▶ 준비됨
0/0

설치

클라이언트 선택

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "k8s": {
      "command": "uvx",
      "args": [
        "k8s-mcp-server"
      ],
      "_inferred": true
    }
  }
}

Claude Desktop → Settings → Developer → Edit Config 열기. 저장 후 앱 재시작.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "k8s": {
      "command": "uvx",
      "args": [
        "k8s-mcp-server"
      ],
      "_inferred": true
    }
  }
}

Cursor는 Claude Desktop과 동일한 mcpServers 스키마 사용. 프로젝트 설정이 전역보다 우선.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "k8s": {
      "command": "uvx",
      "args": [
        "k8s-mcp-server"
      ],
      "_inferred": true
    }
  }
}

Cline 사이드바의 MCP Servers 아이콘 클릭 후 "Edit Configuration" 선택.

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "k8s": {
      "command": "uvx",
      "args": [
        "k8s-mcp-server"
      ],
      "_inferred": true
    }
  }
}

Claude Desktop과 같은 형식. Windsurf 재시작 후 적용.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "k8s",
      "command": "uvx",
      "args": [
        "k8s-mcp-server"
      ]
    }
  ]
}

Continue는 맵이 아닌 서버 오브젝트 배열 사용.

~/.config/zed/settings.json
{
  "context_servers": {
    "k8s": {
      "command": {
        "path": "uvx",
        "args": [
          "k8s-mcp-server"
        ]
      }
    }
  }
}

context_servers에 추가. 저장 시 Zed가 핫 리로드.

claude mcp add k8s -- uvx k8s-mcp-server

한 줄 명령. claude mcp list로 확인, claude mcp remove로 제거.

사용 사례

실전 활용법: k8s-mcp-server

Morning cluster health check via chat

👤 SRE, platform engineers ⏱ ~5 min intermediate

언제 쓸까: Daily, before stand-up — anything red? Any pods crashlooping?

사전 조건
  • kubeconfig on host — Usually ~/.kube/config
흐름
  1. Start the MCP container
    Start k8s-mcp-server via Docker mounting ~/.kube read-only.✓ 복사됨
    → Container up
  2. Run the checks
    Across all namespaces, list pods not in Running state, nodes not Ready, and recent (last 1h) events of type Warning.✓ 복사됨
    → Three-part health report
  3. Triage
    For each crashlooping pod, get last 50 log lines and propose most likely cause.✓ 복사됨
    → Log excerpts + diagnoses

결과: 5-minute daily cluster pulse check.

함정
  • Running kubectl get events cluster-wide floods context — Always filter by time and type

Debug a failed Helm release

👤 Devs shipping Helm charts ⏱ ~15 min intermediate

언제 쓸까: helm upgrade failed and you want to know why without copying error messages back and forth.

흐름
  1. Get history
    helm history my-app -n production. What changed between v4 (working) and v5 (failed)?✓ 복사됨
    → Version diff
  2. Diff templates
    Render the template for v5 with current values and compare against v4. Highlight differences.✓ 복사됨
    → Diff of rendered manifests
  3. Roll back if needed
    Roll back to v4. Confirm all pods become Ready.✓ 복사됨
    → Rollback + health check

결과: Fast recovery with understanding, not just luck.

함정
  • Rolling back without capturing the failure first means you can't fix forward — Always save helm get all v5 to a file before rolling back
함께 쓰기: filesystem

Audit Argo CD apps for drift

👤 GitOps practitioners ⏱ ~20 min advanced

언제 쓸까: You suspect someone kubectl'd something into prod that Argo CD doesn't know about.

흐름
  1. List out-of-sync apps
    argocd app list --output json. Filter to apps where sync status isn't Synced.✓ 복사됨
    → Out-of-sync list
  2. Diff each
    For each drifted app, run argocd app diff and summarize what's different from Git.✓ 복사됨
    → Per-app diff summary

결과: Clear picture of manual drift to reconcile.

조합

다른 MCP와 조합해 10배 효율

k8s + github

When an app is broken in cluster, open GitHub issue with pod logs

If any pod in 'payments' namespace is crashlooping, fetch logs and open a GitHub issue with them attached.✓ 복사됨

도구

이 MCP가 노출하는 것

도구입력언제 호출비용
kubectl command: str (full kubectl args) General cluster ops free
helm command: str Release management free
istioctl command: str Service mesh ops free
argocd command: str GitOps ops (requires argocd login in container) free

비용 및 제한

운영 비용

API 쿼터
None
호출당 토큰
kubectl get -o yaml can be huge; prefer -o json | jq to trim
금액
Free, MIT
Always use -o wide or -o jsonpath=... to trim. kubectl get all is a token-bomb.

보안

권한, 시크릿, 파급범위

최소 스코프: Kubeconfig scoped to a least-privilege ServiceAccount
자격 증명 저장: Mount ~/.kube read-only into the container
데이터 외부 송신: Traffic to your cluster API server only
절대 부여 금지: cluster-admin ServiceAccount to the kubeconfig used by the MCP

문제 해결

자주 발생하는 오류와 해결

The connection to the server localhost:8080 was refused

kubeconfig not mounted or KUBECONFIG env var wrong in the container.

확인: docker exec ... kubectl config view
Command blocked in restrictive mode

Either craft a narrower command, or explicitly opt into permissive mode for that session.

Timeout on long-running command

Raise K8S_MCP_TIMEOUT. For truly long ops, run async via a Job and poll.

대안

k8s-mcp-server 다른 것과 비교

대안언제 쓰나단점/장점
Direct kubectl via ssh-managerYou prefer running kubectl on a jump hostLess structured; no command validation
Kagent / AIOps SaaS MCPsYou want managed service rather than self-hostedCosts money; less control

더 보기

리소스

📖 GitHub에서 공식 README 읽기

🐙 열린 이슈 보기

🔍 400+ MCP 서버 및 Skills 전체 보기