ChatGPTSoftwareInfra & DevOpsAI score · 77/100AI-assisted edit · no obvious prompt-injection riskn8n.io

Manage Kubernetes Clusters via Natural-Language Chat

Build a Chat Trigger → AI Agent → MCP Client workflow in self-hosted n8n, using GPT-4o mini to turn natural language into Kubernetes/Helm commands

ExperiencedStepsWorkflowPromptTip
Who
Platform engineers or DevOps developers who need to manage Kubernetes clusters and already run self-hosted n8n
You get
Query pod logs, list resources, check node metrics, and manage Helm releases through natural-language chat in n8n
You need
n8n

Constraints

Prerequisites: self-hosted n8n ≥0.240.0; OpenAI API Key; accessible Kubernetes cluster; running MCP server (reference implementation provided by author). This template uses community nodes and is only compatible with self-hosted n8n.

What they did

Author reza-gholizade published an n8n workflow template combining Chat Trigger, AI Agent (GPT-4o mini), Simple Memory, and MCP Client nodes to execute Kubernetes and Helm operations via natural-language chat. The workflow contains 27 nodes, 19 of which are MCP Client Tool nodes covering resource listing, logs, metrics, descriptions, create/update, and Helm lifecycle management.

How it went

Published on n8n.io with 4331 views and active status (author_report). The author also provides an open-source k8s-mcp-server implementation supporting SSE and streamable-http transports.

Worth knowing

1) This template is only compatible with self-hosted n8n because it uses the community MCP Client node. 2) The actual model is GPT-4o mini (workflow.json model.value=gpt-4o-mini), not full GPT-4o. 3) The AI Agent systemMessage hardcodes the timezone as Asia/Tehran; change it if you need a different timezone. 4) Destructive operations (createOrUpdateResource, Helm install/upgrade/uninstall/rollback) are gated behind explicit user instruction, but production environments should still consider enabling --read-only mode on the MCP server. 5) The MCP server must be deployed separately with Kubernetes authentication (kubeconfig/token/ServiceAccount); n8n only connects via SSE endpoint. 6) The Helm Repo Add node is disabled by default (disabled=true).

Steps

  1. Import the workflow template

    In your self-hosted n8n instance, load this workflow via the Templates page or JSON import. After import you will see Chat Trigger, AI Agent, OpenAI Chat Model, Simple Memory, and multiple MCP Client Tool nodes.

  2. Configure credentials

    1) Add an OpenAI API Key in n8n Credentials for the OpenAI Chat Model node to call GPT-4o mini. 2) In the MCP Client nodes, set the SSE endpoint URL and authentication (e.g., MCP_AUTH_TOKEN) for your MCP server. Ensure the n8n instance can reach the MCP server over the network.

  3. Set the AI Agent system message

    Open the AI Agent node’s Options and paste the author-provided system message into the System Message field. This message defines available Kubernetes and Helm tools plus usage rules, guiding the model on how to invoke MCP tools and restricting dangerous operations.

  4. Safety tip: human confirmation before action

    Safety tip (editorial safety note, not the template author's practice): before the agent actually creates/updates Kubernetes resources or runs Helm install, upgrade, rollback or uninstall, have a human confirm the target cluster and each operation.

  5. Deploy and connect the MCP server

    Deploy the k8s-mcp-server from the author’s GitHub repository (https://github.com/reza-gholizade/k8s-mcp-server). It supports stdio, SSE, and streamable-http modes; SSE mode requires MCP_AUTH_TOKEN. Ensure the server has Kubernetes cluster access via kubeconfig, token, or ServiceAccount RBAC. In n8n, enter the SSE endpoint (e.g., http://your-server:8080/mcp/kubernetes/sse) into the Kubernetes MCP Client and Helm MCP Client nodes.

  6. Test conversational operations

    Activate the workflow, then send natural-language commands via n8n Chat or the webhook, for example:

    Execution prompt · Source text。n8n Chat Trigger user input examples

    Show me all pods in the default namespace.
    Get logs for nginx pod in kube-system.
    List all deployments in staging.

Prompt you can copy

Execution prompt · Source text。Send it in the n8n chat window (Chat Trigger)

This block is the prompt. Ads are never placed here.

Show me all pods in the default namespace.
Get logs for nginx pod in kube-system.
List all deployments in staging.

Source

Conversational Kubernetes management with GPT-4o and MCP integration · reza-gholizade · n8n.io · 2025-05-13T14:20:56.900Z

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related