CommandOpen

Commands (debug-pod)

Debug a failing or unhealthy Kubernetes pod by analyzing events, logs, and configuration.

Debug a failing or unhealthy Kubernetes pod by analyzing events, logs, and configuration.

Steps

  1. Get pod status: kubectl get pod <name> -n <namespace> -o wide.
  2. Describe the pod for events and conditions: kubectl describe pod <name> -n <namespace>.
  3. Analyze the pod state:
  • Pending: Check node resources, scheduling constraints, PVC binding.
  • CrashLoopBackOff: Check container logs for startup errors.
  • ImagePullBackOff: Verify image name, tag, and registry credentials.
  • OOMKilled: Check memory limits vs actual usage.
  • Running but unhealthy: Check probe configuration and endpoints.
  1. Fetch container logs: kubectl logs <pod> -n <ns> --previous for crash logs.
  2. Check resource usage: kubectl top pod <name> -n <namespace>.
  3. Verify configuration:
  • ConfigMaps and Secrets are mounted correctly.
  • Environment variables are set.
  • Service account has required permissions.
  1. Suggest fixes based on the diagnosis.

Format

Pod: <name> in <namespace>
Status: <status>
Restarts: <count>
Node: <node-name>

Diagnosis:
  Root cause: <description>
  Evidence: <log lines or events>

Fix:
  1. <action to take>
  2. <verification command>

Rules

  • Always check events first; they often reveal the root cause immediately.
  • Fetch logs from the previous container instance for crash analysis.
  • Check node-level issues if multiple pods on the same node are affected.
  • Verify DNS resolution if the pod cannot reach other services.
  • Check RBAC permissions if the pod gets authorization errors.

Source: https://github.com/rohitg00/awesome-claude-code-toolkit/blob/main/plugins/k8s-helper/commands/debug-pod.md

Author: rohitg00, Claude Code toolkit (rohitg00). License: Apache-2.0.

Shown here with formatting for the web. Keep the author and license notice when you reuse it.

Related entries

There are more like this in the members library

The Codex library holds 7,009 entries. Members can search all of them by meaning and read every one in full.