Gestion conversationnelle de Kubernetes basée sur GPT-4o et l'intégration MCP
Ceci est unDevOps, AIworkflow d'automatisation du domainecontenant 14 nœuds.Utilise principalement des nœuds comme McpClientTool, Agent, ChatTrigger, LmChatOpenAi, MemoryBufferWindow, combinant la technologie d'intelligence artificielle pour une automatisation intelligente. Gestion conversationnelle de Kubernetes avec GPT-4o et une intégration MCP
- •Clé API OpenAI
Nœuds utilisés (14)
Catégorie
{
"meta": {
"instanceId": "66f06061721f1f7966ba3bdd29bb7db37d84222e0e73cbdc5057760193ad29bf",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "41c2617e-b606-473d-ac07-ac0c5901935a",
"name": "À la réception d'un message chat",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
400,
-80
],
"webhookId": "2eb47787-160f-49ad-b98d-1d8ee757765c",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"name": "Agent IA",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
800,
-80
],
"parameters": {
"options": {
"systemMessage": "=You are a Kubernetes assistant connected to an MCP (Model Context Protocol) Server. Your role is to help users monitor, inspect, and troubleshoot Kubernetes resources using the following tools.\ncurrent time is {{ $now.setZone('Asia/Tehran') }}\n\nAvailable Tools:\n1. getEvents(namespace) – Fetch events in the given namespace.\n2. getPodsLogs(namespace, podName) – Retrieve logs for a specific pod.\n3. getResource(namespace, resourceKind, resourceName) – Get details of a specific resource.\n4. createOrUpdateResource(namespace, resourceYaml) – Create or update a resource using full YAML.\n5. getNodeMetrics(nodeName) – Retrieve CPU and memory usage of a node.\n6. getPodMetrics(namespace, podName) – Retrieve CPU and memory usage of a pod.\n7. describeResource(namespace, resourceKind, resourceName) – Detailed description of a resource.\n8. listResources(namespace, resourceKind) – List all resources of a given kind in a namespace. for example{\"Kind\": \"Pod\",\"namespace\": \"x\"}\n9. getAPIResources() – List all supported resource kinds in the cluster.\n\nUsage Rules:\n***keep your answers short and meaningful***\n- Always validate input arguments before calling any tool.\n- Ask the user for any missing information (e.g., namespace, podName, resourceKind).\n- Do not assume defaults; always confirm with the user.\n- Avoid destructive operations unless explicitly instructed (only createOrUpdateResource modifies the cluster).\n- Use getAPIResources() to help the user explore available resource kinds.\n- Respond with concise, plain-language explanations of the results when helpful.\n"
}
},
"typeVersion": 1.8
},
{
"id": "61247bd0-5e76-4165-af70-26c0d605d12f",
"name": "Mémoire simple",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
340,
140
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "f8136d5d-c5db-4c4f-a080-ad65d5ef9aac",
"name": "Client MCP",
"type": "n8n-nodes-mcp.mcpClientTool",
"position": [
460,
260
],
"parameters": {
"connectionType": "sse"
},
"credentials": {
"mcpClientSseApi": {
"id": "eyJUyjbc2529AKLS",
"name": "k8s"
}
},
"typeVersion": 1
},
{
"id": "47eae87b-f2fa-46d5-9f77-d168e47e9bfe",
"name": "getAPIResources",
"type": "n8n-nodes-mcp.mcpClientTool",
"position": [
580,
260
],
"parameters": {
"toolName": "getAPIResources",
"operation": "executeTool",
"connectionType": "sse",
"toolParameters": "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"getAPIResources\",\n \"params\": {\n \"arguments\": {\n \"includeNamespaceScoped\": true,\n \"includeClusterScoped\": true\n }\n }\n}"
},
"credentials": {
"mcpClientSseApi": {
"id": "eyJUyjbc2529AKLS",
"name": "k8s"
}
},
"typeVersion": 1
},
{
"id": "648eacf9-436d-44d6-9389-a0a5212071fa",
"name": "listResources",
"type": "n8n-nodes-mcp.mcpClientTool",
"position": [
740,
260
],
"parameters": {
"toolName": "listResources",
"operation": "executeTool",
"connectionType": "sse",
"toolParameters": "={\"Kind\": \"{{ $fromAI('Kind', 'Select the kind given by ai agent', 'string') }}\",\n\"namespace\" : \"{{ $fromAI('namespace', 'Select the namespace given by ai agent', 'string') }}\"}"
},
"credentials": {
"mcpClientSseApi": {
"id": "eyJUyjbc2529AKLS",
"name": "k8s"
}
},
"typeVersion": 1
},
{
"id": "a62f3378-65fe-4178-9fba-b52ba437ca38",
"name": "describeResource",
"type": "n8n-nodes-mcp.mcpClientTool",
"position": [
900,
260
],
"parameters": {
"toolName": "describeResource",
"operation": "executeTool",
"connectionType": "sse",
"toolParameters": "={\"Kind\": \"{{ $fromAI('Kind', 'Select the kind given by ai agent', 'string') }}\",\n\"name\" : \"{{ $fromAI('name', 'Select the name given by ai agent', 'string') }}\",\n\"namespace\" : \"{{ $fromAI('namespace', 'Select the namespace given by ai agent', 'string') }}\"}"
},
"credentials": {
"mcpClientSseApi": {
"id": "eyJUyjbc2529AKLS",
"name": "k8s"
}
},
"typeVersion": 1
},
{
"id": "c159ae52-4963-4103-93ad-083230b46da3",
"name": "getPodMetrics",
"type": "n8n-nodes-mcp.mcpClientTool",
"position": [
1040,
260
],
"parameters": {
"toolName": "getPodMetrics",
"operation": "executeTool",
"connectionType": "sse",
"toolParameters": "={\"podName\" : \"{{ $fromAI('podName', 'Select the pod name given by ai agent', 'string') }}\",\n\"namespace\" : \"{{ $fromAI('namespace', 'Select the namespace given by ai agent', 'string') }}\"}"
},
"credentials": {
"mcpClientSseApi": {
"id": "eyJUyjbc2529AKLS",
"name": "k8s"
}
},
"typeVersion": 1
},
{
"id": "f49b0804-b15a-4a7d-ac9f-44f51795abdf",
"name": "getNodeMetrics",
"type": "n8n-nodes-mcp.mcpClientTool",
"position": [
1180,
260
],
"parameters": {
"toolName": "getNodeMetrics",
"operation": "executeTool",
"connectionType": "sse",
"toolParameters": "={\"Name\" : \"{{ $fromAI('Name', 'Select the name given by ai agent', 'string') }}\"}"
},
"credentials": {
"mcpClientSseApi": {
"id": "eyJUyjbc2529AKLS",
"name": "k8s"
}
},
"typeVersion": 1
},
{
"id": "decd4807-5dbe-4f65-8bd5-8401ee2b0154",
"name": "createorUpdateResource",
"type": "n8n-nodes-mcp.mcpClientTool",
"position": [
1340,
240
],
"parameters": {
"toolName": "createResource",
"operation": "executeTool",
"connectionType": "sse",
"toolParameters": "={\"manifest\" : \"{{ $fromAI('manifest', 'Select the manifest given by ai agent', 'string').trim() }}\",\n\"namespace\" : \"{{ $fromAI('namespace', 'Select the namespace given by ai agent', 'string') }}\"}"
},
"credentials": {
"mcpClientSseApi": {
"id": "eyJUyjbc2529AKLS",
"name": "k8s"
}
},
"typeVersion": 1
},
{
"id": "1b1bc11c-565e-46f7-8b38-e74489ea2372",
"name": "getResource",
"type": "n8n-nodes-mcp.mcpClientTool",
"position": [
1440,
140
],
"parameters": {
"toolName": "getResource",
"operation": "executeTool",
"connectionType": "sse",
"toolParameters": "={\"kind\": \"{{ $fromAI('kind', 'Select the kind given by ai agent', 'string') }}\",\n\"name\" : \"{{ $fromAI('name', 'Select the name given by ai agent', 'string') }}\",\n\"namespace\" : \"{{ $fromAI('namespace', 'Select the namespace given by ai agent', 'string') }}\"}"
},
"credentials": {
"mcpClientSseApi": {
"id": "eyJUyjbc2529AKLS",
"name": "k8s"
}
},
"typeVersion": 1
},
{
"id": "f34b5527-c048-4e6e-b86a-585a586ef8ff",
"name": "getPodsLogs",
"type": "n8n-nodes-mcp.mcpClientTool",
"position": [
1420,
-20
],
"parameters": {
"toolName": "getPodsLogs",
"operation": "executeTool",
"connectionType": "sse",
"toolParameters": "={\"Name\" : \"{{ $fromAI('Name', 'Select the name given by ai agent', 'string') }}\",\n\"namespace\" : \"{{ $fromAI('namespace', 'Select the namespace given by ai agent', 'string') }}\"}"
},
"credentials": {
"mcpClientSseApi": {
"id": "eyJUyjbc2529AKLS",
"name": "k8s"
}
},
"typeVersion": 1
},
{
"id": "68234560-f7f9-4a6a-9579-497ff458fedc",
"name": "getEvents",
"type": "n8n-nodes-mcp.mcpClientTool",
"position": [
1340,
-160
],
"parameters": {
"toolName": "getEvents",
"operation": "executeTool",
"connectionType": "sse",
"toolParameters": "={\n\"namespace\" : \"{{ $fromAI('namespace', 'Select the namespace given by ai agent', 'string') }}\"}"
},
"credentials": {
"mcpClientSseApi": {
"id": "eyJUyjbc2529AKLS",
"name": "k8s"
}
},
"typeVersion": 1
},
{
"id": "9a20f489-799e-44aa-a6cd-2f68814113a6",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
220,
140
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {
"maxTokens": -1
}
},
"credentials": {
"openAiApi": {
"id": "CvwUuKPhahoMTR21",
"name": "OpenAi play ground"
}
},
"typeVersion": 1.2
}
],
"pinData": {},
"connections": {
"68234560-f7f9-4a6a-9579-497ff458fedc": {
"ai_tool": [
[
{
"node": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"type": "ai_tool",
"index": 0
}
]
]
},
"f8136d5d-c5db-4c4f-a080-ad65d5ef9aac": {
"ai_tool": [
[
{
"node": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"type": "ai_tool",
"index": 0
}
]
]
},
"f34b5527-c048-4e6e-b86a-585a586ef8ff": {
"ai_tool": [
[
{
"node": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"type": "ai_tool",
"index": 0
}
]
]
},
"1b1bc11c-565e-46f7-8b38-e74489ea2372": {
"ai_tool": [
[
{
"node": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"type": "ai_tool",
"index": 0
}
]
]
},
"61247bd0-5e76-4165-af70-26c0d605d12f": {
"ai_memory": [
[
{
"node": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"type": "ai_memory",
"index": 0
}
]
]
},
"c159ae52-4963-4103-93ad-083230b46da3": {
"ai_tool": [
[
{
"node": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"type": "ai_tool",
"index": 0
}
]
]
},
"648eacf9-436d-44d6-9389-a0a5212071fa": {
"ai_tool": [
[
{
"node": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"type": "ai_tool",
"index": 0
}
]
]
},
"f49b0804-b15a-4a7d-ac9f-44f51795abdf": {
"ai_tool": [
[
{
"node": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"type": "ai_tool",
"index": 0
}
]
]
},
"47eae87b-f2fa-46d5-9f77-d168e47e9bfe": {
"ai_tool": [
[
{
"node": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"type": "ai_tool",
"index": 0
}
]
]
},
"a62f3378-65fe-4178-9fba-b52ba437ca38": {
"ai_tool": [
[
{
"node": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"type": "ai_tool",
"index": 0
}
]
]
},
"9a20f489-799e-44aa-a6cd-2f68814113a6": {
"ai_languageModel": [
[
{
"node": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"decd4807-5dbe-4f65-8bd5-8401ee2b0154": {
"ai_tool": [
[
{
"node": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"type": "ai_tool",
"index": 0
}
]
]
},
"41c2617e-b606-473d-ac07-ac0c5901935a": {
"main": [
[
{
"node": "be64c331-8fb2-4efd-a10e-beb1938cdb71",
"type": "main",
"index": 0
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Intermédiaire - DevOps, Intelligence Artificielle
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
Reza Gholizade
@reza-gholizadeI'm a seasoned Solution Architect with expertise in designing and implementing complex, scalable systems across various platforms. With a strong foundation in cloud infrastructure, microservices architecture, Kubernetes, and DevOps practices, they specialize in creating innovative solutions using cutting-edge technologies and tools.
Partager ce workflow