How to Manage Kubernetes Clusters Using K8s MCP Server

Updated on 07 May, 2025
How to Manage Kubernetes Clusters Using K8s MCP Server header image

Model Context Protocol (MCP) is a new approach to organizing context for Large Language Models, allowing them to act more intelligently and maintain continuity across tasks, tools, and sessions. By defining key elements like user intent, memory, and available tools, MCP enables more seamless, context-aware interactions in AI applications.

In this article, we'll take you through the steps of running a Kubernetes MCP server container, enabling you to interact with with a Vultr Kubernetes Engine cluster using natural human language. You'll learn how the protocol works and use tools like Claude Desktop to manage the kubernetes cluster.

Prerequisites

Before you begin:

Get Started Right Away

Ensure that you have downloaded the configuration file of your Vultr Kubernetes Engine cluster on your local system.

In this section, we'll pull and run a sample Kubernetes MCP server Docker Container Image.

  1. Display all available contexts defined in the kubeconfig file.

    console
    $ kubectl config get-contexts
    

    Copy the context value in clipboard to use in the later steps.

  2. Pull the sample Kubernetes MCP server Docker container image.

    console
    $ docker pull ghcr.io/alexei-led/k8s-mcp-server:latest
    
  3. Run the sample Kubernetes MCP server Docker container image.

    console
    $ docker run -i --rm \
        -v ~/.kube:/home/appuser/.kube:ro \
        -e K8S_CONTEXT=<VKE_CLUSTER_CONTEXT_VALUE> \
        ghcr.io/alexei-led/k8s-mcp-server:latest
    
  4. Confirm the image is running in Docker desktop application.

Understand the MCP Server

  • Unified Kubernetes CLI Tools
    Includes built-in support for multiple Kubernetes tools like kubectl, helm, istioctl, and argocd—all within a single containerized environment.

  • Cloud-Native Integration
    Offers native compatibility with major Kubernetes providers, including Vultr VKE.

  • Secure by Design
    Runs as a non-root user and enforces strict validation on incoming commands to maintain security and control.

  • Flexible Command Chaining
    Supports command piping and integrates smoothly with Unix utilities like jq, grep, and sed for complex workflows.

  • Simplified Configuration
    Easily customizable through environment variables, minimizing setup time and complexity.

Use Claude Desktop to Interact

Download the Claude Desktop application, it automatically detects MCP servers defined in its configuration file and makes them accessible for use within any conversation.

  1. Start the Claude Desktop application.

  2. Locate the settings option in the application.

  3. Select Developer settings.

  4. Click on Edit Config.

  5. Add the following configuration snippet to your Claude Desktop config file.

    json
    {
    "mcpServers": {
        "kubernetes": {
        "command": "docker",
        "args": [
            "run",
            "-i",
            "--rm",
            "-v",
            "/Users/YOUR_USER_NAME/.kube:/home/appuser/.kube:ro",
            "-e",
            "K8S_CONTEXT=<VKE_CLUSTER_CONTEXT_VALUE>",
            "ghcr.io/alexei-led/k8s-mcp-server:latest"
        ]
        }
    }
    }
    

    Replace the value of K8S_CONTEXT with your actual Kubernetes context name. Also, update the mount path /Users/YOUR_USER_NAME/.kube to point to your real .kube directory (usually ~/.kube on most systems).

  6. Once the new configuration is in place, restart the Claude desktop application.

  7. To confirm the server is running, go to the Developer settings in Claude Desktop and check if the status next to the JSON file shows as running.

  8. Make sure the MCP server tools are available to the application.

    MCP tools

Ask questions and Perform Operations

  • You can manage your Kubernetes Cluster by chatting naturally using the Claude desktop application.

    K8s cluster info

    Make sure the LLM is giving accurate information by matching the information on your Vultr Cluster Information.

Some Available Operations in the Kubernetes MCP Server

Advanced Operations

  • Check the status of Istio service mesh.
  • Create an ArgoCD application for repository.

Deployments & Configuration

  • Deploy the Nginx Helm chart.
  • Create a deployment with 3 replicas of nginx:latest.
  • Set up an Ingress controller.

Troubleshooting

  • Describe the failing pod and explain the error.
  • Check if service is properly connected to the pods.

Basic Commands

  • Show all pods in the default namespace.
  • Get all services across all namespaces.
  • Display the logs for the Nginx pod.

Conclusion

In this article, we've explored the Model Context Protocol (MCP) and how it can be used to manage a Kubernetes cluster through natural language interactions. By leveraging tools like the Kubernetes MCP server Docker container and Claude Desktop, we've simplified the process of administering and interacting with your Vultr Kubernetes Engine cluster. Learn more about MCP and it aspects.

Comments

No comments yet.