Skip to content

GitOps for Application Environments: CNPA practice questions

Once a platform runs more than one environment, the GitOps question becomes how to describe several variants of the same application and how to move a change from one environment to the next. The answers are mostly about repository layout and promotion.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What GitOps for Application Environments covers in CNPA

Once a platform runs more than one environment, the GitOps question becomes how to describe several variants of the same application and how to move a change from one environment to the next. The answers are mostly about repository layout and promotion.

Flux's guide to structuring repositories describes the main options. In a monorepo, all Kubernetes manifests live in one repository, with the environment-specific configuration on the same branch, typically main. A common layout has shared bases and per-environment overlays, for example apps/base, apps/staging and apps/production, plus a clusters directory where each cluster's state references the app and infrastructure overlays it should run. Separating apps from infrastructure lets a cluster reconcile add-ons and controllers before the applications that depend on them. In a repo-per-environment layout production gets its own repository; because Git cannot restrict read access to individual files, a separate repository gives tighter control over who sees production configuration, at the cost of more work when promoting changes. The guide also describes repo-per-team and repo-per-app variants. Branches other than main stay short-lived and are deleted once their pull request merges, in line with trunk-based development.

Kustomize provides the overlay mechanism. A base is a directory with a kustomization.yaml containing a set of resources and customizations; an overlay refers to a base and changes what differs, such as replica counts, resource limits, hostnames or image tags, so most YAML is written once. Helm reaches the same result with one chart and a values file per environment.

Promotion is a change to Git. Flux's guidance shows new application releases delivered automatically to staging through image updates to Git, while version bumps for production are pushed to a new branch so that someone can open and approve a pull request. Infrastructure changes can be more disruptive, so the guide suggests merging them to staging first and promoting them to production only after the staging cluster has reconciled and passed conformance tests, with the promotion gated by pull request reviews and end-to-end tests. Flagger canary releases can limit the impact of a problem that escapes staging.

When many clusters need the same application, Argo CD's ApplicationSet controller generates Applications from a single template. Its list generator uses a literal list of clusters, the cluster generator uses the clusters defined in Argo CD, the Git generator derives parameters from files or directories in a repository, and the matrix generator combines two generators. It also improves self-service in multitenant clusters, letting tenants deploy without a cluster administrator enabling each destination, although the documentation asks readers to understand the security implications first.

Misconceptions: one long-lived branch per environment is not a GitOps requirement, copying complete manifests for each environment is unnecessary, and promotion should never mean rebuilding the image for production.

At associate level, expect questions about choosing a repository layout, using overlays for environment differences, gating promotion to production, and generating per-cluster deployments from one definition.

Key points

  • Monorepo with base and per-environment overlays, or a separate repository for production access control.
  • Kustomize overlays patch a shared base; Helm uses one chart with per-environment values.
  • Promote by changing Git: automatic to staging, pull request approval for production.
  • ApplicationSet generators (list, cluster, Git, matrix) stamp out Applications across clusters.

Three sample questions

8 CNPA questions on GitOps for Application Environments, 8 with explanations. How practice works

Question 1

A platform team wants one Argo CD manifest that deploys an add-on to every cluster registered in Argo CD, including clusters added later. Which ApplicationSet generator fits?
  1. A.The Git generator
  2. B.The Cluster generator
  3. C.A Kustomize overlay
  4. D.The List generator

Correct answer: B

The ApplicationSet docs describe the Cluster generator as automatically generating cluster parameters based on the clusters defined within Argo CD, instead of a literal list; the ApplicationSet controller lets a single manifest target multiple clusters. Why the other options are wrong. "The Git generator": The Git generator creates parameters from files or folders in a Git repository, not from Argo CD's cluster list. "A Kustomize overlay": An overlay customizes manifests; it does not generate one Application per cluster. "The List generator": The List generator uses a fixed, literal list of clusters, so new clusters would have to be added by hand.

Sources: CNCF CNPA curriculum (CNPA_Curriculum.pdf), Argo CD: ApplicationSet controller

Question 2

A repository keeps one folder per environment (envs/dev, envs/staging, envs/prod). The team wants Argo CD to create one Application per folder automatically. Which ApplicationSet generator matches?
  1. A.The Git generator
  2. B.The List generator
  3. C.A Flux Kustomization
  4. D.The Cluster generator

Correct answer: A

The ApplicationSet documentation describes the Git generator as generating parameters based on files or folders contained within the Git repository defined in the generator, so each environment folder can become its own Application. Why the other options are wrong. "The List generator": A literal list would work only if someone maintains it by hand; it is not driven by the folders. "A Flux Kustomization": A Flux Kustomization is a Flux resource, not an Argo CD ApplicationSet generator. "The Cluster generator": The Cluster generator iterates over clusters registered in Argo CD, not over folders.

Sources: CNCF CNPA curriculum (CNPA_Curriculum.pdf), Argo CD: ApplicationSet controller

Question 3

A team uses Flux with one GitRepository holding both staging and production configuration, and two Kustomizations that apply different paths of it. Which statement from the Flux docs supports this design?
  1. A.A GitRepository can only be consumed by a HelmRelease, not by a Kustomization.
  2. B.Sources are fetched only once, when they are created, so both paths must exist on day one.
  3. C.Each Kustomization must point to its own Git repository, so one per environment is required.
  4. D.A source may be shared by several consumers, deduplicating configuration and storage.

Correct answer: D

Flux's core concepts explain that a Source defines the origin of the desired state and produces an artifact consumed by other Flux components, and that a source may be shared by multiple consumers to deduplicate configuration and/or storage. Each Kustomization can then reconcile a different path. Why the other options are wrong. "A GitRepository can only be consumed by a HelmRelease, not by a Kustomization.": Kustomizations consume Git, OCI or bucket artifacts as well. "Sources are fetched only once, when they are created ...": The origin is checked for changes on a defined interval, producing a new artifact when it changes. "Each Kustomization must point to its own Git repository ...": The docs explicitly allow one source to be shared by several consumers.

Sources: CNCF CNPA curriculum (CNPA_Curriculum.pdf), Flux: Core concepts

Practice this topic

Focus mode keeps every question on GitOps for Application Environments until you leave it. 10 free guest answers, then a free account; no credit card.

Or open CNPA practice across all topics.

Sources

The explanation above was checked against these official documents.