기본 트러블슈팅
이 섹션에서는 Amazon Q CLI와 MCP server for Amazon EKS를 사용하여 EKS 클러스터의 문제를 트러블슈팅합니다.
먼저 클러스터에 실패하는 Pod를 배포한 다음, Amazon Q CLI를 사용하여 트러블슈팅을 진행하겠습니다.
~/environment/eks-workshop/modules/aiml/q-cli/troubleshoot/failing-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: failing-pod
namespace: default
labels:
app: volume-demo
spec:
containers:
- name: main-container
image: busybox:1.37.0-glibc
command: ["sleep", "3600"]
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 200m
memory: 256Mi
volumeMounts:
# Persistent volume claim - persistent storage
- name: persistent-storage
mountPath: /data
volumes:
# Persistent Volume Claim
- name: persistent-storage
persistentVolumeClaim:
claimName: my-pvc
restartPolicy: Always
serviceAccountName: default
~$kubectl apply -f ~/environment/eks-workshop/modules/aiml/q-cli/troubleshoot/failing-pod.yaml
Pod의 상태를 확인합니다:
~$kubectl get pods -n default
NAME READY STATUS RESTARTS AGE
failing-pod 0/1 Pending 0 5m29s
보시다시피 클러스터에 pending 상태의 Pod가 있습니다. Q CLI를 사용하여 원인을 조사해 보겠습니다.
새로운 Q CLI 세션을 시작합니다:
~$q chat
Q CLI에 문제 트러블슈팅을 요청하기 위해 다음 질문을 입력합니다:
I have a pod stuck in a pending state in my eks-workshop cluster. Find the cause of the failure and provide me with a summary of the approach to solve it.
프롬프트를 처리하기 위해 Q CLI는 MCP 서버의 다양한 도구를 사용합니다. 수행할 수 있는 단계는 다음과 같습니다:
list_k8s_resources도구를 사용하여 클러스터에서 실패한 Pod 식별manage_k8s_resource도구를 사용하여 Pod의 세부 정보 가져오기get_k8s_events도구를 사용하여 Pod의 Kubernetes 이벤트 기록 검사manage_k8s_resource도구를 사용하여 관련 Kubernetes 리소스의 세부 정보 가져오기search_eks_troubleshoot_guide도구를 사용하여 EKS 트러블슈팅 가이드 검색 및 참조
Q CLI는 클러스터에서 수집한 데이터를 기반으로 분석을 제공합니다.
샘플 응답 확장
## Pod Pending Issue Summary
Problem: Pod failing-pod in the default namespace is stuck in pending state.
Root Cause: The pod references a PersistentVolumeClaim named my-pvc that doesn't exist.
Error Details:
• Status: Unschedulable
• Message: persistentvolumeclaim "my-pvc" not found
• 0/3 nodes available due to missing PVC
Solutions:
1. Create the missing PVC - Create a PersistentVolumeClaim named my-pvc using the available gp2 StorageClass
2. Remove the volume requirement - Edit the pod to remove the volume mount and PVC reference
3. Delete the pod - If it's a test pod that's no longer needed
Available Resources:
• StorageClass gp2 is available for creating PVCs
• 3 worker nodes are healthy and available
The pod will automatically schedule once the PVC is created or the volume requirement is removed.
Q CLI 세션을 종료하려면 다음을 입력합니다:
/quit
이제 실패한 Pod를 제거합니다:
~$kubectl delete -f ~/environment/eks-workshop/modules/aiml/q-cli/troubleshoot/failing-pod.yaml --ignore-not-found
다음 섹션에서는 더 복잡한 트러블슈팅 시나리오를 살펴보겠습니다.