Skip to main content
Glama

Kubernetes Monitor

by vlttnv
MIT License
1
  • Apple
  • Linux

k8s-mcp

Kubernetes クラスター用の Python ベースの読み取り専用モデル コンテキスト プロトコル (MCP)サーバー。クラスター情報を取得して問題を診断するための包括的な API を公開します。

クロードを使ったチャットの例

インストール

前提条件

  • Python 3.8以上
  • Kubernetes クラスターへのアクセス (kubeconfig またはクラスター内構成経由)
  • 必要な Python パッケージ ( pyproject.tomldependenciesを参照)
  • uv - https://github.com/astral-sh/uv
# To install uv curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone the repository git clone git@github.com:vlttnv/k8s-mcp.git cd k8s-mcp # Install dependencies uv venv source .venv/bin/activate uv sync

Claude configure を使用する場合は、テキストエディタで ~/Library/Application Support/Claude/claude_desktop_config.json にある Claude for Desktop App の設定ファイルを開いてください。ファイルが存在しない場合は必ず作成してください。

code ~/Library/Application\ Support/Claude/claude_desktop_config.json
{ "mcpServers": { "k8s-mcp": { "command": "uv", "args": [ "--directory", "/ABSOLUTE/PATH/TO/PARENT/FOLDER/k8s-mcp", "run", "server.py" ] } } }

コマンドフィールドに uv 実行ファイルへのフルパスを入力する必要があるかもしれません。これは、MacOS/Linuxでは which uv 、Windowsでは where uv を実行することで取得できます。

構成

アプリケーションは、Kubernetes クラスターに接続するために次の 2 つの方法を自動的に試行します。

  1. Kubeconfig ファイル: ローカルの kubeconfig ファイルを使用します (通常は~/.kube/configにあります)
  2. クラスタ内構成: Kubernetesポッド内で実行している場合は、サービスアカウントトークンを使用します。

kubeconfig が適切に設定されているか、適切な RBAC 権限を持つクラスター内で実行されている場合は、追加の構成は必要ありません。

使用法

以下は、Kubernetes クラスターとそのリソースについて Claude に質問できる便利なプロンプトの例です。

一般的なクラスターステータス
  • 「クラスターの全体的な健全性はどうですか?」
  • 「クラスター内のすべての名前空間を表示する」
  • 「クラスター内で利用可能なノードとそのステータスは何ですか?」
  • 「ノード全体のリソース使用率はどうですか?」
ポッドとデプロイメント
  • 「本番環境の名前空間内のすべてのポッドを一覧表示する」
  • 「CrashLoopBackOff 状態のポッドはありますか?」
  • 「再起動回数が多いポッドを表示」
  • 「すべての名前空間にわたるすべてのデプロイメントを一覧表示する」
  • 「どの展開が進行に失敗しているのですか?」
デバッグの問題
  • 「ステージング名前空間のポッドが失敗するのはなぜですか?」
  • 「本番環境の名前空間にあるサービスのYAML構成を取得する」
  • 「デフォルトの名前空間の最近のイベントを表示する」
  • 「保留状態のままになっているポッドはありますか?」
  • 「クラスターで ImagePullBackOff エラーが発生する原因は何ですか?」
リソース管理
  • 「クラスター内のノードのリソース消費量を表示してください」
  • 「クリーンアップする必要がある孤立したリソースはありますか?」
  • 「本番環境の名前空間内のすべてのサービスを一覧表示する」
  • 「ステージングと本番環境のリソース要求を比較する」
特定資源検査
  • 「kube-system の coredns デプロイメントの構成を表示してください」
  • 「ステージング中のリバースプロキシサービスの詳細を取得する」
  • 「ポッド xyz ではどのコンテナが実行されていますか?」
  • 「障害が発生したポッドのログを見せてください」

APIリファレンス

名前空間

  • get_namespaces() : クラスター内で利用可能なすべての名前空間を一覧表示する

ポッド

  • list_pods(namespace=None) : オプションで名前空間でフィルタリングされたすべてのポッドを一覧表示します。
  • failed_pods() : 失敗またはエラー状態のすべてのポッドを一覧表示します
  • pending_pods() : 保留状態のすべてのポッドを理由とともに一覧表示する
  • high_restart_pods(restart_threshold=5) : 再起動回数が閾値を超えるポッドを検索する

ノード

  • list_nodes() : すべてのノードとそのステータスを一覧表示する
  • node_capacity() : すべてのノードの利用可能な容量を表示する

導入とサービス

  • list_deployments(namespace=None) : すべてのデプロイメントを一覧表示する
  • list_services(namespace=None) : すべてのサービスを一覧表示する
  • list_events(namespace=None) : すべてのイベントを一覧表示する

リソース管理

  • orphaned_resources() : 所有者参照のないリソースを一覧表示する
  • get_resource_yaml(namespace, resource_type, resource_name) : 特定のリソースのYAML設定を取得する

ライセンス

MITライセンス

貢献

貢献を歓迎します!お気軽にプルリクエストを送信してください。

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Claude などの自然言語インターフェースを通じてクラスター情報を照会し、問題を診断できる、Kubernetes 用の読み取り専用 MCP サーバー。

  1. インストール
    1. 前提条件
  2. 構成
    1. 使用法
    2. APIリファレンス
      1. 名前空間
      2. ポッド
      3. ノード
      4. 導入とサービス
      5. リソース管理
    3. ライセンス
      1. 貢献

        Related MCP Servers

        • A
          security
          F
          license
          A
          quality
          A MCP server that can run Kubernetes commands with a given kubeconfig path and provide interpretation of the commands.
          Last updated -
          1
          2
          JavaScript
          • Apple
        • -
          security
          A
          license
          -
          quality
          An MCP server that enables interaction with Kubernetes/Minikube clusters through natural language, allowing AI agents like Codename Goose to manage Kubernetes resources via the Model Context Protocol.
          Last updated -
          Python
          MIT License
        • -
          security
          F
          license
          -
          quality
          A server that enables LLMs to manage Kubernetes clusters through natural language commands, wrapping kubectl operations to provide a simplified interface for common Kubernetes tasks.
          Last updated -
          3
          Python
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol server that enables AI assistants to interact with Kubernetes clusters through natural language, supporting core Kubernetes operations, monitoring, security, and diagnostics.
          Last updated -
          604
          Python
          MIT License
          • Linux
          • Apple

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/vlttnv/k8s-mcp'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server