GPT-4oとMCP統合を活用した対話型Kubernetes管理

中級

これはDevOps, AI分野の自動化ワークフローで、14個のノードを含みます。主にMcpClientTool, Agent, ChatTrigger, LmChatOpenAi, MemoryBufferWindowなどのノードを使用、AI技術を活用したスマート自動化を実現。 GPT-4oとMCPの統合を使った対話型Kubernetes管理

前提条件
  • OpenAI API Key

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "66f06061721f1f7966ba3bdd29bb7db37d84222e0e73cbdc5057760193ad29bf",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "41c2617e-b606-473d-ac07-ac0c5901935a",
      "name": "チャットメッセージ受信時",
      "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": "AI エージェント",
      "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": "シンプルメモリ",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        340,
        140
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "f8136d5d-c5db-4c4f-a080-ad65d5ef9aac",
      "name": "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 チャットモデル",
      "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
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - DevOps, 人工知能

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
中級
ノード数14
カテゴリー2
ノードタイプ5
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者
Reza Gholizade

Reza Gholizade

@reza-gholizade

I'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.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34