Skip to content

hangool84/automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EKS Pod Health MCP Server

EKS/Kubernetes Pod의 health 상태를 체크하는 간단한 MCP (Model Context Protocol) 서버입니다.

기능

이 MCP 서버는 다음 4가지 tool을 제공합니다:

1. check_k8s_connection

Kubernetes 클러스터 연결 상태를 확인합니다.

Parameters:

  • 없음

Returns:

  • 연결 상태 (connected/disconnected/error)

2. check_pod_health

특정 Pod 또는 Namespace의 모든 Pod의 상세한 health 상태를 확인합니다.

Parameters:

  • namespace (optional): Kubernetes namespace (default: "default")
  • pod_name (optional): 특정 Pod 이름 (없으면 전체 Pod 조회)

Returns:

  • Pod의 phase, ready 상태, 컨테이너 상태, node, IP 정보 등

3. list_unhealthy_pods

Running 상태가 아닌 모든 unhealthy Pod를 나열합니다.

Parameters:

  • namespace (optional): Kubernetes namespace (없으면 전체 namespace 조회)

Returns:

  • Running이 아닌 Pod 목록과 phase, reason, message

4. list_namespaces

사용 가능한 모든 Kubernetes namespace를 나열합니다.

Parameters:

  • 없음

Returns:

  • Namespace 목록과 개수

설치

pip install -r requirements.txt

또는:

pip install mcp kubernetes

실행

python server.py

또는 실행 가능하게 만들어서:

chmod +x server.py
./server.py

사전 요구사항

  • Python 3.10+
  • Kubernetes 클러스터에 대한 접근 권한
  • kubeconfig 파일 설정 (~/.kube/config)

EKS 클러스터 설정 방법:

aws eks update-kubeconfig --name YOUR_CLUSTER --region YOUR_REGION

Claude Desktop 설정

Claude Desktop에서 이 MCP 서버를 사용하려면, claude_desktop_config.json에 다음을 추가하세요:

{
  "mcpServers": {
    "eks-pod-health": {
      "command": "python",
      "args": ["/path/to/automation/server.py"]
    }
  }
}

또는 UV를 사용하는 경우:

{
  "mcpServers": {
    "eks-pod-health": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/automation",
        "run",
        "server.py"
      ]
    }
  }
}

예제 사용법

MCP 클라이언트에서:

check_k8s_connection()
check_pod_health(namespace="default")
check_pod_health(namespace="default", pod_name="my-app-pod-123")
list_unhealthy_pods()
list_unhealthy_pods(namespace="production")
list_namespaces()

주의사항

  • 이 서버는 학습 및 테스트 목적으로 만들어진 간단한 구현입니다
  • 실제 프로덕션 환경에서 사용하려면 에러 처리, 로깅, 인증 등을 추가해야 합니다
  • Kubernetes API 접근 권한이 필요합니다

라이선스

MIT

About

ZMP_Automation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages