skills/kubernetes/SKILL.md
Kubernetes and kubectl mastery for deployments, services, pods, debugging, and cluster management. Use when user asks to "deploy to k8s", "create deployment", "debug pod", "kubectl commands", "scale service", "check pod logs", "create ingress", or any Kubernetes tasks.
npx skillsauth add 1mangesh1/dev-skills-collection kubernetesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Essential kubectl commands and Kubernetes patterns.
# View contexts
kubectl config get-contexts
kubectl config current-context
# Switch context
kubectl config use-context production
# Set default namespace
kubectl config set-context --current --namespace=my-app
# Use namespace in command
kubectl get pods -n kube-system
kubectl get pods --all-namespaces # or -A
# List pods
kubectl get pods
kubectl get pods -o wide # More details
kubectl get pods -w # Watch mode
kubectl get pods --show-labels
kubectl get pods -l app=web # By label
# Pod details
kubectl describe pod my-pod
kubectl get pod my-pod -o yaml
# Logs
kubectl logs my-pod
kubectl logs my-pod -f # Follow
kubectl logs my-pod --tail=100
kubectl logs my-pod -c my-container # Specific container
kubectl logs my-pod --previous # Previous crash
# Exec into pod
kubectl exec -it my-pod -- /bin/sh
kubectl exec -it my-pod -c my-container -- bash
# Port forward
kubectl port-forward my-pod 8080:80
kubectl port-forward svc/my-service 8080:80
# Copy files
kubectl cp my-pod:/app/file.txt ./file.txt
kubectl cp ./file.txt my-pod:/app/
# Delete
kubectl delete pod my-pod
kubectl delete pod my-pod --grace-period=0 --force
# Create deployment
kubectl create deployment web --image=nginx:latest --replicas=3
# List
kubectl get deployments
kubectl get deploy
# Scale
kubectl scale deployment web --replicas=5
# Update image
kubectl set image deployment/web nginx=nginx:1.25
# Rollout status
kubectl rollout status deployment/web
# Rollback
kubectl rollout undo deployment/web
kubectl rollout undo deployment/web --to-revision=2
# History
kubectl rollout history deployment/web
# Restart (rolling)
kubectl rollout restart deployment/web
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
labels:
app: web
spec:
replicas: 3
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: nginx:1.25
ports:
- containerPort: 80
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 256Mi
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 10
periodSeconds: 30
readinessProbe:
httpGet:
path: /ready
port: 80
initialDelaySeconds: 5
periodSeconds: 10
env:
- name: NODE_ENV
value: "production"
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: password
# ClusterIP (internal)
apiVersion: v1
kind: Service
metadata:
name: web
spec:
selector:
app: web
ports:
- port: 80
targetPort: 8080
---
# LoadBalancer (external)
apiVersion: v1
kind: Service
metadata:
name: web-public
spec:
type: LoadBalancer
selector:
app: web
ports:
- port: 80
targetPort: 8080
---
# NodePort
apiVersion: v1
kind: Service
metadata:
name: web-nodeport
spec:
type: NodePort
selector:
app: web
ports:
- port: 80
targetPort: 8080
nodePort: 30080
# Quick expose
kubectl expose deployment web --port=80 --target-port=8080
kubectl expose deployment web --type=LoadBalancer --port=80
# List services
kubectl get svc
kubectl describe svc web
# ConfigMap
kubectl create configmap app-config --from-literal=key=value
kubectl create configmap app-config --from-file=config.yaml
# Secret
kubectl create secret generic db-creds \
--from-literal=username=admin \
--from-literal=password=secret123
# View
kubectl get configmap app-config -o yaml
kubectl get secret db-creds -o jsonpath='{.data.password}' | base64 -d
# Apply manifest
kubectl apply -f deployment.yaml
kubectl apply -f ./k8s/ # All files in directory
kubectl apply -f https://example.com/manifest.yaml
# Delete
kubectl delete -f deployment.yaml
kubectl delete deployment web
kubectl delete all -l app=web # By label
# Dry run
kubectl apply -f deployment.yaml --dry-run=client
kubectl apply -f deployment.yaml --dry-run=server
# Pod not starting?
kubectl describe pod my-pod # Check Events section
kubectl get events --sort-by='.lastTimestamp'
# CrashLoopBackOff?
kubectl logs my-pod --previous # Logs from crashed container
# Can't connect to service?
kubectl get endpoints my-service # Check if endpoints exist
kubectl run debug --rm -it --image=busybox -- wget -qO- http://my-service
# Resource issues?
kubectl top pods
kubectl top nodes
kubectl describe node <node-name> # Check Allocatable vs Allocated
For debugging patterns: references/debugging.md
For YAML templates: references/manifests.md
tools
Parallel execution with xargs, GNU parallel, and batch processing patterns. Use when user mentions "xargs", "parallel", "batch processing", "run in parallel", "parallel execution", "process list of files", "bulk operations", "concurrent commands", "map over files", or running commands on multiple inputs.
development
WebSocket implementation for real-time bidirectional communication. Use when user mentions "websocket", "ws://", "wss://", "real-time", "live updates", "chat application", "socket.io", "Server-Sent Events", "SSE", "push notifications", "live data", "streaming data", "bidirectional communication", "websocket server", "reconnection", or building real-time features.
tools
Frontend bundler configuration for Webpack and Vite. Use when user mentions "webpack", "vite", "bundler", "vite config", "webpack config", "code splitting", "tree shaking", "hot module replacement", "HMR", "build optimization", "bundle size", "chunk splitting", "loader", "plugin", "esbuild", "rollup", "dev server", or configuring JavaScript build tools.
tools
VS Code configuration, extensions, keybindings, and workspace optimization. Use when user mentions "vscode", "vs code", "vscode settings", "vscode extensions", "keybindings", "code editor", "workspace settings", "settings.json", "launch.json", "tasks.json", "vscode snippets", "devcontainer", "remote development", or customizing their VS Code setup.