All skills
nodnarbnitram avatar

/kubernetes-operations

@1ac816c

Assist with Kubernetes interactions including debugging (kubectl logs, describe, exec, port-forward), resource management (deployments, services, configmaps, secrets), and cluster operations (scaling, rollouts, node management). Use when working with kubectl, pods, deployments, services, or troubleshooting Kubernetes issues.

Use this Skill: https://skilld.dev/gh/nodnarbnitram/claude-code-extensions/kubernetes-operations

This session only. Nothing lands on disk.

referencesdebugging-flowchart.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Kubernetes Debugging Flowchart

Decision tree for common pod issues.

Pod Not Starting

Pod Status?
├── Pending
│   ├── Check: kubectl describe pod <name>
│   ├── Look for: "Events" section
│   └── Common causes:
│       ├── Insufficient resources → Check node capacity, adjust requests/limits
│       ├── No matching nodes → Check nodeSelector, affinity, tolerations
│       ├── PVC not bound → Check PVC status and StorageClass
│       └── Image pull issues → Check imagePullSecrets
│
├── ContainerCreating
│   ├── Check: kubectl describe pod <name>
│   └── Common causes:
│       ├── Image pull error → Verify image name and registry auth
│       ├── ConfigMap/Secret missing → Verify referenced resources exist
│       └── Volume mount issues → Check PVC and volume configuration
│
├── CrashLoopBackOff
│   ├── Check: kubectl logs <name> --previous
│   ├── Check: kubectl describe pod <name> (exit code)
│   └── Common causes:
│       ├── Exit code 1 → Application error, check logs
│       ├── Exit code 137 → OOMKilled, increase memory limit
│       ├── Exit code 143 → SIGTERM, check liveness probe
│       └── Missing config → Check env vars and mounts
│
├── ImagePullBackOff
│   ├── Check: kubectl describe pod <name>
│   └── Common causes:
│       ├── Image not found → Verify image:tag exists
│       ├── Auth error → Check imagePullSecrets
│       └── Network error → Check registry connectivity
│
└── Running but not working
    ├── Check: kubectl logs <name>
    ├── Check: kubectl exec -it <name> -- /bin/sh
    └── Common causes:
        ├── Readiness probe failing → Check probe config and endpoint
        ├── Wrong command/args → Verify entrypoint
        └── Missing dependencies → Check service connectivity

Service Not Accessible

Can't reach service?
│
├── Check service exists
│   kubectl get svc <name> -n <ns>
│
├── Check endpoints
│   kubectl get endpoints <name> -n <ns>
│   └── Empty? → Pod labels don't match service selector
│
├── Check pod labels match selector
│   kubectl get svc <name> -o jsonpath='{.spec.selector}'
│   kubectl get pods -l <selector> -n <ns>
│
├── Test from within cluster
│   kubectl run debug --rm -it --image=busybox -- wget -qO- http://<svc>:<port>
│
└── Check NetworkPolicy
    kubectl get networkpolicy -n <ns>
    └── Blocking traffic? → Update policy or test without it

High Resource Usage

Resource issues?
│
├── Check current usage
│   kubectl top pods -n <ns>
│   kubectl top nodes
│
├── OOMKilled containers
│   ├── Check: kubectl describe pod <name> (look for OOMKilled)
│   ├── Solution: Increase memory limits
│   └── Investigate: Profile application memory usage
│
├── CPU throttling
│   ├── Check: kubectl describe pod <name> (look for CPU limits)
│   └── Solution: Increase CPU limits or optimize application
│
└── Node pressure
    ├── Check: kubectl describe node <name>
    ├── Look for: MemoryPressure, DiskPressure, PIDPressure
    └── Solution: Add nodes, evict pods, or clean up disk

Quick Diagnosis Commands

# 1. Get overview
kubectl get pods -n <ns> -o wide

# 2. Check specific pod
kubectl describe pod <name> -n <ns>

# 3. Get logs
kubectl logs <name> -n <ns> --tail=100

# 4. Get previous logs (if restarting)
kubectl logs <name> -n <ns> --previous

# 5. Check events
kubectl get events -n <ns> --sort-by='.lastTimestamp' | tail -20

# 6. Shell into pod
kubectl exec -it <name> -n <ns> -- /bin/sh

# 7. Check resource usage
kubectl top pod <name> -n <ns>

Exit Code Reference

Code Signal Meaning
0 - Success
1 - General error
126 - Command not executable
127 - Command not found
128+n Signal n Killed by signal
137 SIGKILL (9) OOMKilled or force killed
143 SIGTERM (15) Graceful termination
255 - Exit status out of range

Source: SKILL.md on GitHub

1 warning6mo4 checks · Risk SAFE
  • Gen Agent Trust Hub7mo

    This skill provides a robust set of tools and instructions for managing Kubernetes clusters via kubectl. It emphasizes security best practices, such as verifying cluster context and using dry-runs for destructive operations. The included Python scripts are designed for token efficiency and do not utilize external dependencies or network calls outside of standard kubectl operations.

  • Socket6mo

    No alerts

  • Snyk7mo

    Risk: LOW · No issues

  • Runlayer7mo

    8/8 files flagged

Signed by skilld at 1ac816c. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 6 months ago
What it can do
Reads files Runs commands
All 4 allowed tools
ReadGrepGlobBash

README badge

README badge for nodnarbnitram/claude-code-extensions/kubernetes-operations