
-prod, -staging, BACKUP, DO-NOT-DELETE. New hires spend days asking “which file is the truth?”
Example of a flat, unstructured repo:
Why this happens: Git is flexible but neutral. You must design the layout and rules.
Separate application code from GitOps configuration
Application source and GitOps config have different lifecycles, owners, and review processes:
- Application code: frequent commits, feature reviews, CI pipelines.
- GitOps config (manifests, Helm values, Kustomize overlays): less frequent, security and platform review, different change cadence.
- Ownership: dev teams typically own app repos; platform teams own cluster-level and platform config.
- Kubernetes Basics: https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/
- Helm: https://helm.sh/
- Kustomize: https://kubectl.docs.kubernetes.io/guides/introduction/kustomize/
Recommendation: start with a monorepo for small-to-medium teams. Consider migrating to multi-repo when you exceed ~20–30 services or need stricter access boundaries.
Example layouts
base/ directory and keep per-environment differences in small overlays/ folders. This mirrors the Kustomize approach and makes diffs small and auditable.
Example structure:
- Replicas (dev: 1, staging: 2, prod: 5)
- Resource requests/limits (small in dev, larger in prod)
- Secret references (each environment uses its own secret names)
- Ingress/URLs (e.g.,
api-dev.example.comvsapi.example.com)

Keep overlays minimal. Express only environment deltas (replicas, resource sizes, secret names, URLs). Avoid duplicating the entire manifest in overlays.
-
Branch-based
- Each environment maps to a branch (
dev,staging,main/prod). - Promotion = merge from lower env branch to higher env branch.
- Pros: conceptually simple. Cons: branch management overhead.
- Each environment maps to a branch (
-
Directory-based
- Each environment has its own directory (
envs/dev,envs/staging,envs/prod). - Promotion = open a PR that updates the next environment’s directory.
- Pros: Git-native audit trail via PRs; works well with CI checks.
- Each environment has its own directory (
-
Image tag–based (often combined with directory-based)
- Environments reference image tags in overlays/values.
- Promotion = update the image tag in the next environment’s file.
- Pros: clear traceability of which image is running where; compatible with automated deployment pipelines.
- Clear ownership boundaries: developers manage app folders; the platform team manages infra.
- Consistent patterns across teams make the repo self-documenting and minimize tribal knowledge.
- Easy automation: ApplicationSets or templating tools can onboard new apps and environments quickly.

- Separate code from config: different lifecycles, owners, and review processes mean separate repos and access controls.
- Use base + overlays to avoid duplication and keep per-environment diffs small and auditable.
- Define and document a clear promotion path (directory-based + image tag promotion is a practical default).
- Separate apps from infrastructure so teams can operate independently and safely.