GitOps Principles & Practice›Level 1 · Cheat sheet & self-check

Level 1 — The model · wrap-up

Cheat sheet & self-check

Every command from this section on one page.

01 · What GitOps is

See the loop in action (Argo CD / Flux)

argocd app get orders-apiDesired (Git) vs live state, sync and health status
argocd app diff orders-apiExactly what differs between Git and the cluster
flux get kustomizations -AFlux: which Git paths are applied, and their status
flux reconcile kustomization apps --with-sourceFlux: pull and apply now instead of waiting
git log --oneline -- environments/prod/Every change ever made to production, with author and reason

02 · Repository design

Render and check locally

kustomize build apps/orders-api/envs/prodExactly what Kustomize will produce for prod
helm template orders-api charts/orders-api -f envs/prod/values.yamlRender a chart with prod values
diff <(kustomize build envs/staging) <(kustomize build envs/prod)What differs between two environments
kubeconform -strict -summary rendered/Validate rendered manifests against Kubernetes schemas

03 · Promotion between environments

Promote by hand (it's just Git)

yq -i '.image.digest = "sha256:..."' apps/orders-api/envs/staging/values.yamlSet the new digest for staging
cd apps/orders-api/envs/prod && kustomize edit set image ghcr.io/acme/orders-api@sha256:...Set the image in a Kustomize overlay
git switch -c promote/orders-api-prod && git commit -am "orders-api: promote 1.4.0 to prod"Promotion as a reviewable branch
gh pr create --title "orders-api 1.4.0 -> prod" --body "Soaked 24h in staging, SLOs green"Open the promotion PR

Roll back

git revert <promotion-commit>Undo a promotion; the agent redeploys the previous version
git log --oneline -- apps/orders-api/envs/prod/Every version prod has run