Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

Chapter 7Name in the course: Promotion, image updates and security

Promote releases safely between environments

A release moves from staging to production by a commit — a new image tag in the prod overlay. Automate the boring part (CI or image automation updates the tag), keep a human approval for production, and protect the config repository like production itself.

  • 4 Lessons
  • 6 Commands

$ run as a normal user# run as root (or with sudo)

7.1

Update the image tag from CI

After a green build, CI writes the new tag into the staging overlay and opens a PR for prod.

cd shop-deploy/overlays/staging
kustomize edit set image ghcr.io/s0sta/shop=ghcr.io/s0sta/shop:1.4.1
git commit -am "staging: shop 1.4.1" && git push
gh pr create --title "prod: shop 1.4.1" --body "Tested on staging." --base main --head promote/1.4.1

7.2

Automate tags with Flux image automation

Flux scans the registry, picks the newest tag that matches a policy, and commits it.

image-policy.yaml
apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImagePolicy
metadata: { name: shop, namespace: flux-system }
spec:
  imageRepositoryRef: { name: shop }
  policy:
    semver: { range: ">=1.4.0 <2.0.0" }

Argo CD has the same idea in Argo CD Image Updater.

7.3

Keep production safe

Production changes need review and a way back.

  • Branch protection on the config repository: PR + approval + checks.
  • CI checks on the config: kubectl kustomize renders, kubeconform validates, trivy config scans.
  • Rollback = git revert of the promotion commit.
  • Progressive delivery (Argo Rollouts, Flagger): canary or blue/green with automatic rollback on bad metrics.
kubectl kustomize overlays/prod | kubeconform -strict -summary
git revert HEAD && git push

7.4

Secure the GitOps system

Whoever can write to the config repository controls the cluster.

RiskControl
Someone pushes a bad manifestBranch protection, CODEOWNERS, required reviews
Fake commitsRequire signed commits; Flux can verify commit signatures
Argo CD UI misuseSSO, RBAC per project, no anonymous access
Broad agent rightsAppProjects / Flux service accounts per tenant
Unsigned imagesAdmission policy: only signed images (CKS supply chain)

Remember

GitOps moves the "keys to production" from CI into Git. Protect Git accordingly.

All commands in this chapter