スキル一覧に戻る
pypeaday

k8s-troubleshoot

by pypeaday

le dots

2🍴 0📅 2026年1月23日
GitHubで見るManusで実行

SKILL.md


name: k8s-troubleshoot description: "Debug Kubernetes issues using kubectl, logs, events, and resource inspection. Use on 'pod not starting', 'crash loop', 'OOMKilled', 'debug k8s', 'why is pod failing'."

Kubernetes Troubleshooting Skill

Systematic debugging for Kubernetes issues.

When to Use

  • Pods stuck in Pending/CrashLoopBackOff
  • OOMKilled containers
  • Service connectivity issues
  • Deployment rollout failures
  • PVC/storage problems

Diagnostic Flow

1. Get Status

kubectl get pods -o wide
kubectl get events --sort-by='.lastTimestamp'
kubectl describe pod <pod>

2. Check Logs

kubectl logs <pod> --previous  # crashed container
kubectl logs <pod> -c <container>  # specific container
stern <pod-prefix>  # multiple pods

3. Resource Issues

kubectl top pods
kubectl describe node <node> | grep -A5 "Allocated resources"

Common Issues

Pending Pod

CauseCheckFix
No resourceskubectl describe pod -> EventsIncrease limits or add nodes
No matching nodeCheck nodeSelector/affinityFix selectors
PVC not boundkubectl get pvcCheck storage class

CrashLoopBackOff

CauseCheckFix
App errorkubectl logs --previousFix app code
Missing configCheck ConfigMap/Secret mountsCreate missing resources
Bad commandCheck command/args in specFix entrypoint
OOMKilledkubectl describe pod -> StateIncrease memory limit

ImagePullBackOff

CauseCheckFix
Wrong imageCheck image name/tagFix image reference
Private registryCheck imagePullSecretsAdd registry credentials
Rate limitCheck eventsUse registry mirror

Service Not Reachable

# Check endpoints exist
kubectl get endpoints <service>

# Check selector matches pods
kubectl get pods -l <selector>

# Test from inside cluster
kubectl run debug --rm -it --image=alpine -- wget -qO- <service>:<port>

Quick Commands

# All failing pods
kubectl get pods --field-selector=status.phase!=Running

# Events for namespace
kubectl get events --sort-by='.lastTimestamp' -n <ns>

# Resource usage
kubectl top pods --sort-by=memory

# Shell into pod
kubectl exec -it <pod> -- /bin/sh

# Port forward for debugging
kubectl port-forward <pod> 8080:80

# Restart deployment
kubectl rollout restart deployment/<name>

# Check rollout status
kubectl rollout status deployment/<name>
# Errors
kubectl logs <pod> | grep -i error

# Python tracebacks
kubectl logs <pod> | grep -A 20 "Traceback"

# OOM
kubectl logs <pod> | grep -i "out of memory\|oom\|killed"

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です