메인 콘텐츠로 건너뛰기
Kubernetes 클러스터를 연결하면 Kai가 워크로드를 분석하고, 리소스를 최적화하며, 클러스터 운영을 관리할 수 있습니다. Kubernetes는 클라우드 공급자 자동 검색(EKS, GKE, AKS의 경우) 또는 자체 관리 클러스터를 위한 클러스터 엔드포인트 정보와 함께 서비스 어카운트 토큰을 통해 연결됩니다.

사전 요구사항

연결 전에 Metrics Server를 설치하세요 — 파드 및 노드 리소스 메트릭에 필요합니다:
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
구성 요소용도
Metrics Server파드 및 노드 리소스 메트릭에 필요
kube-state-metrics향상된 클러스터 메트릭 (선택 사항)
네트워크 접근CloudThinker가 클러스터 API 서버에 접근 가능해야 함

지원 플랫폼

플랫폼지원
Amazon EKS전체 버전
Google GKEStandard, Autopilot
Azure AKS전체 버전
자체 관리Kubernetes 1.24+
RancherRKE, RKE2
OpenShift4.x

설정

클라우드 연결에서 자동 검색

이미 AWS, GCP, Azure를 연결한 경우, 관리형 Kubernetes 클러스터가 자동으로 검색됩니다.
1

클라우드 공급자 연결

먼저 AWS, GCP, 또는 Azure 연결을 설정하세요.
2

클러스터 자동 검색

EKS, GKE, 또는 AKS 클러스터가 CloudThinker에 자동으로 나타납니다. 분석에 사용할 클러스터를 선택하세요. CloudThinker는 활성화된 각 클러스터에 대해 Connected 상태를 표시합니다.

연결 세부 정보

CloudThinker가 직접 연결에 사용하는 kubeconfig 형식:
apiVersion: v1
kind: Config
clusters:
- cluster:
    certificate-authority-data: <base64-encoded-ca-cert>
    server: https://your-cluster-endpoint:6443
  name: your-cluster
contexts:
- context:
    cluster: your-cluster
    user: cloudthinker-readonly
  name: cloudthinker-context
current-context: cloudthinker-context
users:
- name: cloudthinker-readonly
  user:
    token: <your-service-account-token>

필요 권한

최소 (읽기 전용)

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: cloudthinker-readonly
rules:
- apiGroups: [""]
  resources: ["pods", "nodes", "services", "namespaces", "events", "configmaps"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["apps"]
  resources: ["deployments", "replicasets", "statefulsets", "daemonsets"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["autoscaling"]
  resources: ["horizontalpodautoscalers"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["metrics.k8s.io"]
  resources: ["pods", "nodes"]
  verbs: ["get", "list"]

권장 (전체 분석)

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: cloudthinker-full-analysis
rules:
- apiGroups: [""]
  resources: ["pods", "nodes", "services", "namespaces", "events", "configmaps", "secrets", "persistentvolumeclaims", "resourcequotas", "limitranges", "replicationcontrollers"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["apps"]
  resources: ["deployments", "replicasets", "statefulsets", "daemonsets"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["batch"]
  resources: ["jobs", "cronjobs"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["networking.k8s.io"]
  resources: ["ingresses", "networkpolicies"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["autoscaling"]
  resources: ["horizontalpodautoscalers"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["metrics.k8s.io"]
  resources: ["pods", "nodes"]
  verbs: ["get", "list"]
최소 ClusterRole로 시작하고, 더 넓은 기능이 필요한 경우에만 전체 분석 역할로 확장하세요. 절대로 write 동사를 부여하지 마세요 — get, list, watch면 Kai의 모든 기능에 충분합니다.

에이전트 기능

연결이 완료되면 Kai가 클러스터를 검사하고 최적화할 수 있습니다.
기능설명
리소스 분석파드 CPU/메모리 사용량, 요청 대비 제한
노드 상태노드 상태, 용량, 할당 가능한 리소스
워크로드 최적화적정 크기 조정 권고사항, HPA 튜닝
문제 해결CrashLoopBackOff, OOMKilled, 보류 중인 파드
보안 감사RBAC 검토, 파드 보안, 네트워크 정책

연결 확인

@kai check the cluster connection and list all namespaces and node count

예시 프롬프트

@kai analyze pod resource utilization in the production namespace and #report the top CPU and memory consumers
@kai investigate crash loops in the payment service and #recommend a fix
@kai check node resource pressure across the cluster and #alert if any node is near capacity

문제 해결

API 서버 엔드포인트가 인터넷에서 접근 가능한지 확인하세요. 방화벽 규칙과 보안 그룹이 CloudThinker의 IP를 허용하는지 확인하세요. 프라이빗 클러스터의 경우 VPN 또는 배스천 접근을 설정하고 API 서버 인증서가 유효한지 확인하세요.
서비스 어카운트 토큰이 올바른지 확인하세요. ClusterRoleBinding이 적용되었고 토큰이 만료되지 않았는지 확인하세요. 서비스 어카운트가 올바른 네임스페이스에 존재하는지 확인하세요.
kubectl top nodes를 실행하여 Metrics Server가 설치되어 있는지 확인하세요. Metrics Server 파드가 실행 중이고 metrics.k8s.io API가 사용 가능한지 확인하세요.
ClusterRole에 네임스페이스 목록 권한이 포함되어 있는지 확인하세요. RBAC이 특정 네임스페이스에 대한 접근을 제한하는지 확인하고 서비스 어카운트 바인딩이 클러스터 전체에 적용되어 있는지 확인하세요.

보안

  • 최소 권한 — 에이전트가 사용 사례에 필요한 권한만 부여하세요. 읽기 전용으로 시작한 후 필요에 따라 확장하세요.
  • 기본 읽기 전용 — 에이전트가 이 연결을 통해 변경 작업을 수행하게 할 것이 아니라면 읽기 전용 자격증명을 사용하세요.
  • 자격증명 교체 — 정기 일정에 따라 키와 토큰을 교체하세요. 연결을 업데이트하면 CloudThinker가 새 값을 자동으로 반영합니다.
  • 오프보딩 시 취소 — 연결을 삭제하거나 팀원이 퇴사할 때 프로바이더에서 자격증명을 제거하세요.
  • 읽기 전용 접근 — CloudThinker 서비스 어카운트에 write 동사를 절대 부여하지 마세요. get, list, watch면 모든 에이전트 기능에 충분합니다.
  • 네임스페이스 격리 — 감사 및 취소를 간편하게 하기 위해 서비스 어카운트를 전용 네임스페이스(예: cloudthinker)에 보관하세요.

관련 항목

Kai 에이전트

Kubernetes 중심 최적화 에이전트
https://mintcdn.com/cloudthinker/aLd-ttc-SCW-aFky/images/icons/aws.svg?fit=max&auto=format&n=aLd-ttc-SCW-aFky&q=85&s=45d526a3e9345214c0345f277da2e829

AWS 연결

EKS 자동 검색을 위한 AWS 연결