본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)5.1k · #15047

k8s-debug-gpu-pod

하는 일

네임스페이스 안의 문제 있는 모든 Pod를 확인하고, 이벤트, 스케줄링, 리소스, 이미지 가져오기, 충돌을 바탕으로 원인을 찾습니다. GPU Pod를 포함해 Kubernetes에서 Pod를 실행하는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓Kubernetes Pod가 Pending 상태에 멈춰 있을 때.
  • ✓Pod가 CrashLoopBackOff로 계속 충돌할 때.
  • ✓Pod가 이미지를 가져오지 못하고 ImagePullBackOff를 표시할 때.

스킬 링크

https://github.com/Project-HAMi/HAMi/blob/master/skill/k8s-debug-gpu-pod/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/Project-HAMi/HAMi/blob/master/skill/k8s-debug-gpu-pod/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 gpu 네임스페이스의 일부 Pod가 Pending에 멈춰 있어요. 이유를 찾고 무엇을 고쳐야 하는지 알려 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트가 네임스페이스와 클러스터 컨텍스트를 묻고, 모든 Pod의 상태를 본 뒤 문제 있는 Pod마다 이벤트와 세부 정보를 확인합니다. 각 Pod의 근본 원인을 보고합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Interaction

Collect the following from the user in a single exchange before starting diagnosis:

Input Required Default
Namespace Yes —
Kubeconfig file path No ~/.kube/config
Context name No current-context in the kubeconfig

If the user provides a cluster name instead of a context, fuzzy-match it against available contexts in the kubeconfig and confirm the match.

The skill automatically discovers and diagnoses all unhealthy pods (Pending, CrashLoopBackOff, ImagePullBackOff, Error) in the namespace. No pod name is needed.

Command Convention

All kubectl commands use shorthand below. Actual execution must always include explicit flags:

kubectl --kubeconfig=<kubeconfig> --context=<context> ...

Never rely on default kubeconfig or current-context.

Diagnostic Workflow

Step 1: Global Pod Overview

Get a full picture of all pod states in one command:

kubectl get pods -n <namespace> -o wide

Categorize pods into:

  • ✅ Running/Completed — healthy, skip
  • 🟡 Pending — go to Step 3
  • 🔴 CrashLoopBackOff/Error — go to Step 4
  • 🔴 ImagePullBackOff/ErrImagePull — go to Step 5
  • ⚠️ Other abnormal states — note for report

All unhealthy pods are diagnosed. No manual pod selection needed.

Step 2: Event Triage

Quick scan of recent warning events for immediate signal:

kubectl get events -n <namespace> --field-selector type=Warning --sort-by=.lastTimestamp | tail -50

Use events to guide which deep-dive steps are most relevant. Common event→action mapping:

Event Reason Points to
FailedScheduling Step 3 (Pending)
CrashLoopBackOff / BackOff Step 4 (Crash)
ImagePullBackOff / ErrImagePull Step 5 (Image)
OOMKilled Step 4 (Crash)
FailedAttachVolume / FailedMount PVC issue — note in report
Unhealthy Probe misconfiguration — note in report
Evicted Node pressure — note in report
NodeNotReady Infrastructure issue — note in report

Short-circuit rule: If events clearly point to a single root cause (e.g., all events are FailedScheduling with the same message), mark it as the confirmed primary cause but still scan remaining steps at reduced depth for additional findings.

Step 3: Pending Pod Root Cause Analysis

For each Pending pod:

kubectl describe pod <pod-name> -n <namespace>

Parse the Events and Conditions sections. Common causes:

Event Message Pattern Root Cause Remediation
Insufficient cpu / Insufficient memory Resource exhaustion Reduce requests, scale cluster, or check quota (→ Step 6)
0/N nodes are available + taint Taint/toleration mismatch Add toleration or untaint node
0/N nodes are available + node selector No matching nodes Fix nodeSelector or add matching nodes
0/N nodes are available + affinity Affinity rule unsatisfiable Relax affinity rules
persistentvolumeclaim "X" not found Missing PVC Create PVC or fix claim name
pod has unbound immediate PersistentVolumeClaims PVC not bound Check StorageClass and PV availability
exceeded quota Quota limit hit → Step 6

Step 4: CrashLoopBackOff / Error Diagnosis

Only execute if Step 1 found pods in CrashLoopBackOff or Error state.

A. Termination reason:

kubectl get pod <pod-name> -n <namespace> -o jsonpath='{.status.containerStatuses[*].lastState.terminated}'
Termination Reason Root Cause Remediation
OOMKilled Memory limit exceeded Increase memory limits, profile usage
exitCode 1 Application failure Check logs, configs, secrets, dependencies
exitCode 137 SIGKILL / OOM Check node pressure and memory
exitCode 139 Segfault Debug binary compatibility
exitCode 143 SIGTERM not handled Review graceful shutdown

B. Logs (current + previous):

kubectl logs <pod-name> -n <namespace> --tail=100
kubectl logs <pod-name> -n <namespace> --previous --tail=100

C. Resource config:

kubectl get pod <pod-name> -n <namespace> -o jsonpath='{.spec.containers[*].resources}' | jq .

D. Restart count:

kubectl get pod <pod-name> -n <namespace> -o jsonpath='{.status.containerStatuses[*].restartCount}'

High restart count (>5) combined with short uptime indicates persistent failure — check probes, dependencies, and startup ordering.

자주 묻는 질문

Pod 이름을 알려 줘야 하나요?

아니요. 스킬이 네임스페이스에서 문제 있는 Pod를 모두 스스로 찾습니다.

어떤 클러스터를 사용하나요?

여러분이 준 kubeconfig와 컨텍스트를 쓰고, 생략하면 kubeconfig의 기본값을 씁니다.

이미지 가져오기 오류도 다루나요?

네. ImagePullBackOff와 ErrImagePull 오류를 위한 단계가 있습니다.

상세 정보

작성자의 원본 설명

Use when pods are stuck in Pending, CrashLoopBackOff, or ImagePullBackOff state. Performs event-driven triage to quickly identify root cause, then deep-dives into scheduling failures, resource exhaustion, image pull errors, and crash loops.

repo: Project-HAMi/HAMi

인기도

GitHub 스타
5.1k
순위
#15047
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬