AI Assistants for Kubernetes: Secure Cluster Operations with MCP and Rafay ZTKA

Interact with Your Rafay Managed Kubernetes Clusters Using MCP-compatible AI clients

February 25, 2026

.png)

The Model Context Protocol (MCP) is an open standard that enables AI assistants to securely interact with external tools and systems. When used with Kubernetes, MCP allows an AI assistant to execute operations (for example, kubectl commands), retrieve live cluster state, and reason about results without requiring users to manually copy and paste output into a chat interface.

This blog uses Claude Desktop as an example AI assistant. The same approach applies to any MCP-compatible AI client.

For platform administrators, this capability enables controlled, auditable, and policy-driven AI-assisted cluster operations.

Recommended Architecture: Local MCP Server with Rafay ZTKA Kubeconfig

For production environments, the recommended approach is to run the MCP server locally and connect to your Kubernetes cluster using a Rafay Zero Trust Kubectl Access (ZTKA) kubeconfig.

In this model:

This architecture aligns with zero-trust security principles and enterprise compliance requirements.

Security and Governance Considerations for Platform Admins

When integrating AI-driven access into Kubernetes environments, security, identity, and auditability must remain fully enforced. Rafay ZTKA ensures:

  1. Authentication (AuthN) and Authorization (AuthZ)
    • Access is tied to verified user identity
    • Authorization is enforced via Rafay RBAC policies
    • No static tokens or long-lived credentials are required
    • Permissions are evaluated for every request

The AI assistant does not bypass cluster security controls; it operates strictly within the RBAC boundaries of the authenticated user.

  1. Audit Logging
    • Every kubectl request routed through ZTKA is recorded in the Rafay platform
    • All actions initiated via the MCP server are fully auditable
    • Logs can be used for compliance validation, forensics, and operational review

This ensures AI-assisted operations are as traceable as manual administrative actions.

  1. RBAC-Controlled Access

    • Access to clusters, namespaces, and resources is governed by Rafay RBAC
    • Platform teams can restrict AI-assisted access to specific roles or environments
    • Fine-grained access control remains intact
  2. No Exposed Cluster Endpoints

    • ZTKA uses a secure relay architecture
    • Kubernetes API servers do not need to be publicly accessible
    • No direct inbound network exposure is introduced

Prerequisites

Before enabling MCP-based Kubernetes access, ensure the following components are installed and configured:

Installing mcp-server-kubernetes globally ensures the executable is available in your system PATH, allowing your AI client to invoke it correctly.

{
  "mcpServers": {
    "kubernetes": {
      "command": "mcp-server-kubernetes",
      "env": {
        "KUBECONFIG": "/path/to/ztka-cluster-config.yaml"
      }
    }
  }
}

Replace /path/to/ztka-cluster-config.yaml with the actual path to your ZTKA kubeconfig.

Connecting Your AI Client (Example: Claude Desktop)

After configuring the MCP server to use your ZTKA kubeconfig:

Start a new session and select the Kubernetes integration if prompted.

Once connected, the AI assistant can securely execute Kubernetes commands through the MCP server.

Validate the Integration

To verify the setup, try simple test commands such as:

On first use, your AI client will request permission to execute Kubernetes operations. Approve the request to continue.

Operational Recommendations for Platform Teams

Before rolling out this capability broadly:

Summary

By combining MCP with Rafay ZTKA, organizations can enable AI-driven Kubernetes interactions without compromising security, visibility, or compliance.

This integration provides:

What's Next

We are developing a native Rafay MCP Server that will expose Rafay-specific discovery and action-oriented capabilities through MCP including multi-cluster operations, add-on and blueprint management, and more. Stay tuned for updates.