DatOps — Cheatsheet

// DevOps шпаргалка

Команды, которыми пользуюсь на практике — kubectl, Docker, Git, Terraform, Nginx. Ищи или фильтруй по инструменту.

58 shown

kubectl logs -f <pod> -n <ns> --previous
Tail logs from a pod, including its last crashed instance
kubectl #debug#pods
kubectl rollout restart deploy/<name> -n <ns>
Force a rolling restart without changing the image tag
kubectl #deploy#rollout
kubectl rollout status deploy/<name> -n <ns>
Watch a rollout until it finishes or stalls
kubectl #debug#rollout
kubectl describe pod <pod> -n <ns>
Show events and container state — first stop for CrashLoopBackOff
kubectl #debug#pods
kubectl exec -it <pod> -n <ns> -- sh
Shell into a running container
kubectl #debug#network
kubectl get pods -A -o wide
List every pod across all namespaces with node and IP info
kubectl #debug#pods
kubectl apply -f <file>
Create or update resources from a manifest
kubectl #deploy
kubectl delete pod <pod> -n <ns> --grace-period=0 --force
Force-delete a pod stuck in Terminating
kubectl #debug#pods
kubectl port-forward svc/<name> 8080:80 -n <ns>
Forward a local port into a service for local debugging
kubectl #debug#network
kubectl top pods -n <ns>
Show live CPU/memory usage per pod
kubectl #debug
kubectl config use-context <ctx>
Switch the active cluster context
kubectl #config
helm upgrade -i <release> <chart> -n <ns> -f values.yaml
Install or upgrade a release, idempotent
helm #deploy
helm rollback <release> <revision> -n <ns>
Roll a release back to a previous revision
helm #rollback
helm template <chart> -f values.yaml | less
Render manifests locally without touching the cluster
helm #debug
helm list -A
List releases across every namespace
helm #debug
helm uninstall <release> -n <ns>
Remove a release and all resources it created
helm #cleanup
helm get values <release> -n <ns>
Show the values actually in use for a running release
helm #debug
helm repo update
Refresh local chart repository indexes
helm #config
helm lint <chart>
Validate a chart for syntax and best-practice issues
helm #debug
argocd app sync <app>
Trigger a sync to reconcile live state with git
argocd #deploy
argocd app diff <app>
Show drift between live and desired state
argocd #debug
argocd app get <app>
Show sync/health status and the resource tree
argocd #debug
argocd app rollback <app> <id>
Roll an app back to a previous deployed revision
argocd #rollback
argocd app set <app> -p key=value
Override a Helm/Kustomize parameter for an app
argocd #config
argocd app history <app>
List deployment history with revision IDs
argocd #history
docker build --no-cache -t <image>:<tag> .
Rebuild an image ignoring layer cache — use when a COPY isn't picking up changes
docker #build
docker compose logs -f --tail=200 <service>
Follow recent logs for one service in a compose stack
docker #debug
docker system prune -af --volumes
Remove all unused containers, images, networks and volumes
docker #cleanup
docker exec -it <container> sh
Shell into a running container by name or ID
docker #debug
docker ps -a
List all containers, including stopped ones
docker #debug
docker compose up -d --build
Rebuild and start a compose stack in the background
docker #deploy
docker inspect <container>
Dump a container's full config and state as JSON
docker #debug
docker stats
Live CPU, memory and network usage per container
docker #debug
docker volume prune -f
Remove unused volumes
docker #cleanup
docker tag <image>:<tag> <registry>/<image>:<tag>
Retag an image before pushing it to a registry
docker #build
git rebase -i HEAD~5
Interactively squash or reorder the last 5 commits
git #history
git reflog
List every HEAD move — the way back after a bad reset
git #recover
git cherry-pick <sha>
Apply a single commit from another branch onto the current one
git #history
git reset --soft HEAD~1
Undo the last commit but keep the changes staged
git #undo
git stash -u
Shelve tracked and untracked changes
git #undo
git log --oneline --graph --decorate -20
Compact branch and commit history view
git #history
git fetch --all --prune
Sync all remotes and drop refs to deleted branches
git #history
git branch -D <branch>
Force-delete a local branch
git #undo
git merge --abort
Bail out of a conflicted merge back to the pre-merge state
git #recover
git diff --staged
Review exactly what's about to be committed
git #history
terraform plan -out=tfplan
Preview changes and save the plan for a matching apply
terraform #plan
terraform state rm <resource>
Drop a resource from state without destroying it
terraform #state
terraform taint <resource>
Force a resource to be destroyed and recreated on next apply
terraform #debug
terraform apply tfplan
Apply a previously saved plan exactly as reviewed
terraform #deploy
terraform destroy -target=<resource>
Tear down a single resource
terraform #state
terraform fmt -recursive
Normalize formatting across all .tf files
terraform #config
terraform state list
List every resource tracked in state
terraform #state
terraform import <resource> <id>
Bring an existing resource under Terraform management
terraform #state
terraform workspace select <name>
Switch to a different state workspace
terraform #config
gitlab-runner exec docker <job>
Run a single CI job locally against the docker executor
gitlab-ci #pipeline
nginx -t
Validate config syntax before reloading
nginx #config
nginx -s reload
Reload config without dropping active connections
nginx #deploy
caddy validate --config Caddyfile
Check a Caddyfile for errors before deploying it
caddy #config