Skip to content
Skillpedia
Deploy & cloud (DevOps)5.1k · #15047

k8s-debug-gpu-pod

What it does

It checks every unhealthy pod in a namespace and works out the cause from events, scheduling, resources, image pulls, and crashes. It is for people who run pods on Kubernetes, including GPU pods.

When to use it

  • ✓When a Kubernetes pod is stuck in Pending.
  • ✓When a pod keeps crashing with CrashLoopBackOff.
  • ✓When a pod cannot pull its image and shows ImagePullBackOff.

Skill link

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

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

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.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Some pods in my gpu namespace are stuck in Pending. Find out why and what to fix.”

5 new skills a week. 1 minute to read.

How it works

The agent asks for the namespace and cluster context, looks at the state of all pods, then checks events and details for each unhealthy pod. It reports the root cause for each one.

Technical content (original SKILL.md)

Original text by the author, straight from 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.

FAQ

Do I need to name the pod?

No. The skill finds all unhealthy pods in the namespace on its own.

Which cluster does it use?

The kubeconfig and context you give it, or the default in your kubeconfig if you leave them out.

Does it cover image pull errors?

Yes. It has a step for ImagePullBackOff and ErrImagePull errors.

Details

Original description by the author

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

Popularity

GitHub stars
5.1k
Ranking position
#15047
License
Apache-2.0
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills