kubectl

SKILL.md

kubectl

Manage Kubernetes clusters using kubectl CLI.

Environment Variables

  • KUBECONFIG - Path to kubeconfig file (optional, defaults to ~/.kube/config)

Cluster info

kubectl cluster-info
kubectl get nodes -o wide

List resources

kubectl get pods -A --no-headers | head -30
kubectl get deployments -n default
kubectl get services -n default
kubectl get namespaces

Describe a resource

kubectl describe pod my-pod -n default
kubectl describe deployment my-app -n default

View logs

kubectl logs deployment/my-app -n default --tail=50
kubectl logs my-pod -n default -c my-container --tail=100

Scale deployment

kubectl scale deployment my-app --replicas=3 -n default

Restart deployment (rolling)

kubectl rollout restart deployment/my-app -n default

Rollout status

kubectl rollout status deployment/my-app -n default

Rollout history

kubectl rollout history deployment/my-app -n default

Apply manifest

kubectl apply -f /tmp/manifest.yaml

Get resource as YAML

kubectl get deployment my-app -n default -o yaml

Port forward

kubectl port-forward svc/my-service 8080:80 -n default &

Get events

kubectl get events -n default --sort-by='.lastTimestamp' | tail -20

Top (resource usage)

kubectl top pods -n default
kubectl top nodes

Notes

  • Always specify -n namespace to avoid operating on the wrong namespace.
  • Use --dry-run=client -o yaml to preview changes before applying.
  • Confirm before running destructive operations (delete, scale to 0, drain).
  • For multi-cluster setups, use kubectl config use-context to switch contexts.
Weekly Installs
1
First Seen
Mar 1, 2026
Installed on
amp1
cline1
opencode1
cursor1
kimi-cli1
codex1