cheatsheet.antonnovikov.com
DevOps cheatsheet
1,661 commands across 116 tools, each with a one-line explanation. Search, filter by tool or tag; click a command to copy it.
Commands 1,661 shown
-
kubectl get pods -A -o wideAll pods with node placement and IPs
-
Describe a podkubectl
kubectl describe pod <name> -n <ns>Full details: events, conditions, volume mounts
-
Follow pod logskubectl
kubectl logs -f <pod> -n <ns>Stream logs in real time; add -c <container> for multi-container pods
-
Logs from previous containerkubectl
kubectl logs <pod> --previous -n <ns>Logs from the last crashed/restarted container instance
-
Exec into podkubectl
kubectl exec -it <pod> -n <ns> -- bashInteractive shell inside a running container
-
Port-forward a servicekubectl
kubectl port-forward svc/<name> 8080:80 -n <ns>Tunnel a cluster service port to localhost
-
Watch rollout statuskubectl
kubectl rollout status deployment/<name> -n <ns>Block until rollout completes or times out (use in CI)
-
Rollback deploymentkubectl
kubectl rollout undo deployment/<name> -n <ns>Revert to the previous revision
-
Scale deploymentkubectl
kubectl scale deployment/<name> --replicas=3 -n <ns>Immediately change replica count
-
Get events sorted by timekubectl
kubectl get events -A --sort-by='.lastTimestamp'Recent cluster events, oldest first — great for post-incident review
-
Server-side dry-runkubectl
kubectl apply --server-side --dry-run=server -f file.yamlValidate manifest against live API without applying changes
-
Export live resource as YAMLkubectl
kubectl get deployment/<name> -n <ns> -o yamlCurrent live state with managed fields stripped; useful as a base
-
Force delete stuck podkubectl
kubectl delete pod <name> -n <ns> --grace-period=0 --forceRemove a Terminating pod immediately (use with caution)
-
Copy file from podkubectl
kubectl cp <ns>/<pod>:/remote/path ./local-pathExtract a file from a running container
-
Cordon a nodekubectl
kubectl cordon <node>Mark node as unschedulable — no new pods land here
-
Drain a nodekubectl
kubectl drain <node> --ignore-daemonsets --delete-emptydir-dataGracefully evict all pods before maintenance
-
Edit a live resourcekubectl
kubectl edit deployment/<name> -n <ns>Open resource in $EDITOR; changes applied on save
-
Verify RBAC permissionskubectl
kubectl auth can-i list pods --as=system:serviceaccount:<ns>:<sa> -n <ns>Check what a ServiceAccount is allowed to do
-
helm install <release> <chart> -f values.yaml -n <ns> --create-namespaceDeploy a chart; creates namespace if it doesn't exist
-
helm upgrade --install <release> <chart> -f values.yaml -n <ns>Safe in CI — installs if absent, upgrades if present
-
helm diff upgrade <release> <chart> -f values.yaml -n <ns>Show exactly what will change (requires helm-diff plugin)
-
helm template <release> <chart> -f values.yaml --debugOutput rendered YAML to stdout without deploying
-
helm get values <release> -n <ns> --allAll computed values for a deployed release
-
helm list -A --output tableAll Helm releases across every namespace
-
helm rollback <release> <revision> -n <ns>Revert to a specific historical revision
-
helm uninstall <release> -n <ns>Remove release and all managed resources
-
Lint a charthelm
helm lint <chart-dir> -f values.yaml --strictValidate chart structure and values; fails on warnings in --strict mode
-
flux checkVerify all Flux controllers are running and CRDs are installed
-
flux get all -ASummary table: Kustomizations, HelmReleases, Sources — with sync status
-
flux reconcile kustomization <name> --with-source -n <ns>Trigger immediate git pull + apply
-
flux reconcile helmrelease <name> --with-source -n <ns>Re-run Helm install/upgrade cycle immediately
-
Trace a resourceflux
flux trace <kind>/<name> -n <ns>Show which Flux objects own and manage this resource
-
flux suspend kustomization <name> -n <ns>Pause sync — useful while doing manual hotfixes
-
flux resume kustomization <name> -n <ns>Re-enable a suspended Kustomization or HelmRelease
-
flux export kustomization --all > clusters/cluster.yamlBackup current Flux config as plain YAML for bootstrapping another cluster
-
docker buildx build --platform linux/amd64,linux/arm64 -t reg/img:tag --push .Cross-compile and push directly to registry with BuildKit
-
docker run --rm -it --env-file .env -p 8000:8000 img:tagLocal run with env vars from file; --rm auto-removes on exit
-
Inspect image layersdocker
docker history --no-trunc img:tagSee each layer, its command, and size; identify bloat
-
Prune everything unuseddocker
docker system prune -af --volumesRemove stopped containers, unused images, networks, volumes
-
docker pull src-reg/img:tag && docker tag src-reg/img:tag dst-reg/img:tag && docker push dst-reg/img:tagRe-tag and push to another registry
-
Save image to tarballdocker
docker save img:tag | gzip > img.tar.gzExport an image for air-gapped transfer
-
Plan with var fileterraform
terraform plan -var-file=prod.tfvars -out=plan.tfplanShow changes; save plan artifact for CI gating
-
Apply a saved planterraform
terraform apply plan.tfplanApply exactly the previously generated plan — no interactive prompts
-
Import existing resourceterraform
terraform import module.path.resource_type.name <remote-id>Bring an already-existing resource under Terraform control
-
Show state for a resourceterraform
terraform state show module.path.resource_type.nameInspect Terraform state attributes for a single resource
-
Move resource in stateterraform
terraform state mv old.address new.addressRename/reorganize resource without destroying and recreating it
-
Ephemeral debug containerk8s-debug
kubectl debug -it <pod> --image=nicolaka/netshoot -n <ns>Attach a debug container (netshoot) to a running pod — shares PID/net namespaces
-
Node resource usagek8s-debug
kubectl top nodesCPU and memory per node (requires metrics-server)
-
Pod resource usage sortedk8s-debug
kubectl top pods -A --sort-by=memoryMemory-sorted pod usage across all namespaces — find the hungry ones
-
Check what's in a ConfigMapk8s-debug
kubectl get cm <name> -n <ns> -o jsonpath='{.data}'Print just the data field; pipe to python -m json.tool for formatting
-
Decode a Secretk8s-debug
kubectl get secret <name> -n <ns> -o jsonpath='{.data}' | python3 -c "import sys,json,base64; [print(k,'=',base64.b64decode(v).decode()) for k,v in json.load(sys.stdin).items()]"Dump and base64-decode all fields in a k8s Secret
-
List all resources in namespacek8s-debug
kubectl api-resources --verbs=list --namespaced -o name | xargs -I{} kubectl get {} -n <ns> --ignore-not-foundEnumerate every resource type in a namespace — useful for auditing
-
JSONPath on any resourcek8s-debug
kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}\t{.metadata.name}\t{.status.phase}\n{end}'Extract specific fields from k8s API objects without jq
-
kubectl get pods -n <ns> -o custom-columns='NAME:.metadata.name,NODE:.spec.nodeName,STATUS:.status.phase'Print only the fields you care about without jq
-
Patch resource fieldkubectl
kubectl patch deployment <name> -n <ns> -p '{"spec":{"replicas":2}}'Inline JSON patch without editing the whole manifest
-
Annotate resourcekubectl
kubectl annotate pod <pod> -n <ns> key=value --overwriteSet or update an annotation; --overwrite replaces existing value
-
Label resourcekubectl
kubectl label node <node> role=worker --overwriteAdd or change a label on any resource
-
Add taint to nodekubectl
kubectl taint nodes <node> key=value:NoSchedulePrevent pods without matching toleration from scheduling on node
-
Remove taint from nodekubectl
kubectl taint nodes <node> key=value:NoSchedule-Remove a taint by appending a dash at the end
-
Set image on deploymentkubectl
kubectl set image deployment/<name> <container>=image:tag -n <ns>Rolling-update the container image without editing YAML
no commands match — try a different search
loading all commands…