Skip to content
Skills Library
DevOps & cloud · Learning & explanation

kubectl

/kubectl

kubectl command-line usage and scripting: kubeconfig and context management, output formats (jsonpath, custom-columns, go-template), all major verbs (get, describe, apply, delete, exec, logs, port-forward, rollout, scale, drain), workload resources, config/storage, networking, RBAC, node management, debugging (CrashLoopBackOff, ImagePullBackOff, OOMKilled), and scripting patterns (dry-run, diff, wait, jq, kustomize). WHEN: \"kubectl\", \"k8s CLI\", \"kubeconfig\", \"namespace\", \"pod\", \"deployment\", \"service\", \"ingress\", \"configmap\", \"secret\", \"rollout\", \"scale\", \"drain\", \"t

Licence
MIT
Last repository change
23.09.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
8
Scripts
3
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 23.09.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 3 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/01-cluster-health.sh, scripts/02-app-debug.sh, scripts/03-namespace-report.sh

What it does and when to use it

kubectl command-line usage and scripting: kubeconfig and context management, output formats (jsonpath, custom-columns, go-template), all major verbs (get, describe, apply, delete, exec, logs, port-forward, rollout, scale, drain), workload resources, config/storage, networking, RBAC, node management, debugging (CrashLoopBackOff, ImagePullBackOff, OOMKilled), and scripting patterns (dry-run, diff, wait, jq, kustomize). WHEN: \"kubectl\", \"k8s CLI\", \"kubeconfig\", \"namespace\", \"pod\", \"deployment\", \"service\", \"ingress\", \"configmap\", \"secret\", \"rollout\", \"scale\", \"drain\", \"t

Triggers from the description

kubectl\k8s CLI\kubeconfig\namespace\pod\deployment\service\ingress\
Original author description

kubectl command-line usage and scripting: kubeconfig and context management, output formats (jsonpath, custom-columns, go-template), all major verbs (get, describe, apply, delete, exec, logs, port-forward, rollout, scale, drain), workload resources, config/storage, networking, RBAC, node management, debugging (CrashLoopBackOff, ImagePullBackOff, OOMKilled), and scripting patterns (dry-run, diff, wait, jq, kustomize). WHEN: \"kubectl\", \"k8s CLI\", \"kubeconfig\", \"namespace\", \"pod\", \"deployment\", \"service\", \"ingress\", \"configmap\", \"secret\", \"rollout\", \"scale\", \"drain\", \"t

How it works

  1. How to Approach Tasks
  2. Core Expertise
  3. Common Pitfalls
  4. Reference Files
  5. Scripts
Original SKILL.md headings · 150 lines, 780 words
SKILL.md preview
---
name: kubectl
description: "kubectl command-line usage and scripting: kubeconfig and context management, output formats (jsonpath, custom-columns, go-template), all major verbs (get, describe, apply, delete, exec, logs, port-forward, rollout, scale, drain), workload resources, config/storage, networking, RBAC, node management, debugging (CrashLoopBackOff, ImagePullBackOff, OOMKilled), and scripting patterns (dry-run, diff, wait, jq, kustomize). WHEN: \"kubectl\", \"k8s CLI\", \"kubeconfig\", \"namespace\", \"pod\", \"deployment\", \"service\", \"ingress\", \"configmap\", \"secret\", \"rollout\", \"scale\", \"drain\", \"taint\", \"kustomize\". Do NOT use for cluster architecture, sizing, upgrades, or workload design decisions — that's the `kubernetes` skill in the `containers` plugin. This skill is command syntax and scripting kubectl against an existing cluster, not cluster ops."
license: MIT
---

# kubectl Expert

This skill covers kubectl, the Kubernetes command-line tool. It has deep coverage of:

- Configuration (kubeconfig, contexts, namespaces, multiple clusters, auth)
- Output formats (default, wide, yaml, json, jsonpath, custom-columns, go-template)
- All major verbs (get, describe, create, apply, delete, edit, patch, exec, logs, port-forward, cp, top, explain, diff, rollout, scale, autoscale, drain, cordon, taint)
- Workload resources (pods, deployments, replicasets, statefulsets, daemonsets, jobs, cronjobs)
- Configuration and storage (configmaps, secrets, PVCs, PVs, storage classes)
- Networking (services, ingress, network policies, endpoints, DNS debugging)
- RBAC (roles, rolebindings, clusterroles, clusterrolebindings, service accounts, auth can-i)
- Node management (labels, taints, cordon, drain, top)
- Debugging (pod states, CrashLoopBackOff, ImagePullBackOff, OOMKilled, ephemeral containers, events)
- Scripting patterns (dry-run, diff, wait, jq integration, batch operations, kustomize)

## How to Approach Tasks

When you receive a request:

1. **Classify** the request type:
   - **Configuration/context** -- Load `references/core.md`
   - **Resource management** -- Load `references/commands.md`
   - **Debugging/troubleshooting** -- Load `references/debugging.md`
   - **Scripting/automation** -- Load `references/patterns.md`

2. **Identify scope** -- Determine namespace. Remind user to check `kubectl config current-context` and default namespace.

3. **Prefer declarative** -- Use `kubectl apply -f` over imperative commands for production workloads. Use imperative for quick debugging.

4. **Use dry-run for safety** -- Preview changes with `--dry-run=client -o yaml` before applying.

5. **Provide complete commands** -- Include namespace flags (`-n`) when relevant.

## Core Expertise

### Configuration

```bash
kubectl config get-contexts                            # list contexts
kubectl config current-context                         # show current
kubectl config use-context my-cluster                  # switch context
kubectl config set-context --current --namespace=myapp # set default ns

# Multiple clusters
KUBECONFIG=~/.kube/config:~/.kube/other kubectl config view --merge --flatten > ~/.kube/merged
```

### Output Formats

```bash
kubectl get pods -o wide                               # extra columns
kubectl get pods -o yaml                               # full YAML
kubectl get pods -o json                               # full JSON
kubectl get pods -o name                               # resource names only

# JSONPath
kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.phase}{"\n"}{end}'
kubectl get pod my-pod -o jsonpath='{.spec.nodeName}'
kubectl get secret my-secret -o jsonpath='{.data.password}' | base64 --decode

# Custom columns
kubectl get pods -o custom-columns='NAME:.metadata.name,STATUS:.status.phase,NODE:.spec.nodeName'

# Go template
kubectl get pods -o go-template='{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'
```

### Common Operations

```bash
# Pods
kubectl run nginx --image=nginx:1.25 --port=80
kubectl run -it --rm debug --image=busybox --restart=Never -- /bin/sh
kubectl get pods -A -o wide
kubectl describe pod my-pod
kubectl logs my-pod -f --tail=100
kubectl logs my-pod --previous
kubectl exec -it my-pod -- /bin/bash
kubectl delete pod my-pod

# Deployments
kubectl create deployment nginx --image=nginx:1.25 --replicas=3
kubectl set image deployment/my-app my-app=myapp:v2
kubectl rollout status deployment/my-app
kubectl rollout undo deployment/my-app
kubectl rollout restart deployment/my-app
kubectl scale deployment my-app --replicas=5

# Services
kubectl expose deployment my-app --port=80 --target-port=8080 --type=ClusterIP
kubectl port-forward service/my-app 8080:80
```

### Debugging

```bash
kubectl describe pod my-pod                            # events + state
kubectl logs my-pod --previous                         # crashed container
kubectl get pod my-pod -o jsonpath='{.status.containerStatuses[0].lastState}'
kubectl debug my-pod -it --image=busybox --target=app  # ephemeral container
kubectl get events --sort-by=.lastTimestamp             # recent events
kubectl get events --field-selector=type=Warning       # warnings only
```

## Common Pitfalls

**1. Applying without checking diff**
Always run `kubectl diff -f manifest.yaml` before `kubectl apply` in production.

**2. Not using `--previous` for crashed container logs**
When a container CrashLoopBackOff, `kubectl logs` shows current (empty) output. Use `--previous`.

**3. Forgetting `-n` namespace flag**
Without `-n`, commands target the default namespace. Set a default with `set-context --current --namespace=X`.

**4. Using `kubectl delete` instead of declarative removal**
Use `kubectl delete -f manifest.yaml` to match the apply workflow.

**5. Draining nodes without --ignore-daemonsets**
DaemonSet pods cannot be evicted. Always pass `--ignore-daemonsets` to `kubectl drain`.

**6. Exit code 137 misidentified**
Exit code 137 = OOMKilled (128 + SIGKILL 9). Increase memory limits, do not look for application bugs.

**7. Not checking endpoints after service creation**
If `kubectl get endpoints my-svc` shows no endpoints, the service selector does not match any pod labels.

**8. Ignoring resource requests/limits**
Pods without requests are best-effort and will be evicted first under memory pressure. Always set requests.

**9. Using kubectl create in production**
`create` fails if the resource exists. Use `apply` for idempotent operations.

**10. Not using --field-selector for events**
`kubectl get events` returns all events. Filter with `--field-selector=involvedObject.name=my-pod`.

## Reference Files

- `references/core.md` -- kubeconfig, contexts, namespaces, output formats (jsonpath, custom-columns, go-template), core verbs. Read for configuration and output questions.
- `references/commands.md` -- Complete command reference: workloads, config/storage, networking, RBAC, node management. Read for specific resource commands.
- `references/debugging.md` -- Pod debugging, ImagePullBackOff/CrashLoopBackOff/OOMKilled diagnosis, network debugging, events, explain. Read when troubleshooting.
- `references/patterns.md` -- Scripting: dry-run, diff, wait, jq integration, batch operations, kustomize, multi-container patterns. Read for automation scripts.

## Scripts

- `scripts/01-cluster-health.sh` -- Cluster overview: nodes, pod summary, resource usage, events
- `scripts/02-app-debug.sh` -- Application debugging: deployment, pods, logs, connectivity
- `scripts/03-namespace-report.sh` -- Per-namespace resource report with issue detection
Files in this package (8)
  • SKILL.md 7 KB
  • references/commands.md 8 KB
  • references/core.md 5 KB
  • references/debugging.md 7 KB
  • references/patterns.md 4 KB
  • scripts/01-cluster-health.sh 5 KB
  • scripts/02-app-debug.sh 6 KB
  • scripts/03-namespace-report.sh 5 KB

Versions

RepositoryScoreLicence
This page · chrishuffman5/domain-expert100MIT
serejaris/kimi-skills100MIT
antgroup/agent3sigma-canary95Apache-2.0

Database snapshot: 13.11.2026 · package version f3e2d569dee4 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100kubernetes-expert
    Expert Kubernetes: workloads, services, config, probes, resources, and troubleshooting. Trigger keywords: Kubernetes, k8s, Deployment, StatefulSet, Service, Pod, ConfigMap, Secret, Ingress, liveness, readiness, probe, requests, limits, HPA, kubectl, Helm, CrashLoopBackOff,…
  • 100kubernetes-deployment
    Deploy services to a Kubernetes cluster for DevOps tasks. Use when manifests, Kustomize overlays, Helm charts, namespaces, rollout status, kubectl, or kubeconfig under project-root `.k8s/` are involved, while preventing kubeconfig tokens, client keys, Secret manifests, and…
  • 95kubernetes-patterns
    Kubernetes workload patterns, resource management, RBAC, probes, autoscaling, ConfigMap/Secret handling, and kubectl debugging for production-grade deployments. Use when writing or reviewing Kubernetes manifests, or debugging probes, RBAC, autoscaling, or resource limits.
  • 100k8s-workload-troubleshooting
    Use when a pod or workload is unhealthy in Kubernetes: pods stuck in Pending, CrashLoopBackOff, ImagePullBackOff or ErrImagePull, containers OOMKilled (exit code 137), failing liveness, readiness or startup probes, pods Running but not Ready, a Deployment rollout that does not…
  • 100devops-kubernetes
    Use when writing, reviewing, applying or debugging workloads on an existing Kubernetes cluster - Deployment, StatefulSet, DaemonSet, Job/CronJob, ConfigMap/Secret usage, Services, Gateway API (HTTPRoute) or a migration away from Ingress/Ingress NGINX, PV/PVC/StorageClass, RBAC…
  • 90Kubernetes
    Debugs Kubernetes workloads and reviews manifests: pods, probes, resources, rollouts, Services, storage, RBAC. Use when a pod is Pending, CrashLoopBackOff, ImagePullBackOff, OOMKilled or stuck Terminating, when a Service or Ingress serves nothing or returns 502/503/504, when…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.