Back to Blog
Guide
5 min read
April 15, 2026

How to Use Kubernetes MCP with Claude Code

Manage pods, deployments, services, and configs in your Kubernetes cluster from Claude Code — inspect workloads, debug failures, and apply manifests with AI assistance.

kubernetesk8sdevopscontainersclaude-code

What is the Kubernetes MCP?

The Kubernetes MCP connects Claude Code to your Kubernetes cluster via the Kubernetes API. Claude can list and inspect workloads, read pod logs, describe failing resources, apply manifests, and help you troubleshoot cluster issues — all with the context of your application code.

Installation

mcpizy install kubernetes

The MCP uses your local kubeconfig file (~/.kube/config) by default. Specify a context with the KUBECONFIG_CONTEXT environment variable to target a specific cluster.

Key Capabilities

  • List and inspect resources — pods, deployments, services, ingresses, configmaps, secrets metadata.
  • Read pod logs — stream logs from any pod or container, including previous crash logs.
  • Describe resources — get the full kubectl describe output for diagnosing scheduling or crash issues.
  • Apply and delete manifests — deploy YAML manifests directly from your codebase.
  • Scale workloads — adjust replica counts on deployments and statefulsets.

Example Usage

A pod is in CrashLoopBackOff. Ask Claude to debug it:

// Claude will:
// 1. kubectl describe pod  — check events for OOM or image pull errors
// 2. kubectl logs  --previous — read the last crash's stderr
// 3. Cross-reference with the deployment manifest
// 4. Suggest resource limit adjustments or config fixes

Tips and Best Practices

  • Use a read-only ClusterRole for exploratory debugging to prevent accidental cluster changes.
  • Combine with Terraform MCP to manage cluster infrastructure alongside application workloads.
  • Ask Claude to validate your YAML manifests before applying — it can catch common mistakes like missing resource limits.
  • Use namespace filtering to scope Claude's access to only the namespaces relevant to your work.

View on MCPizy Marketplace

Found this useful? Share it.

MCP Servers Mentioned

KubernetesDockerTerraform
All ArticlesBrowse Marketplace