How do you structure repositories for GitOps? Should app code and deployment config live together?
What they are really testing: Whether you know the common practice of separating app source from deployment config and the reasons (avoid build/deploy loops, different access). Repo layout is a real early decision.
A real interview question
How do you structure repositories for GitOps? Should app code and deployment config live together?
What most people say
drag me
“I would put the Kubernetes manifests in the same repo as the application code.”
Co-locating is tempting but couples build and deploy: a manifest tweak triggers an app build, an app commit can change prod directly, and access control gets muddy. The common practice is a separate config repo.
The follow-ups they ask next
Why not keep manifests in the application repo?
It couples build and deploy: manifest edits trigger app builds, app commits can change prod directly, and access control blurs. A separate config repo keeps the lifecycles and permissions distinct.
How do you represent multiple environments in the config repo?
Directories or Kustomize overlays (sometimes branches): a base plus per-environment overrides. Promotion becomes a change to the target environment path, reviewed via PR.
What the interviewer is listening for
- Separates app source from config repo
- Explains build/deploy decoupling + access control
- Environments as overlays/folders
What sinks the answer
- Co-locates manifests with app code by default
- No build/deploy separation
- No environment structure
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“Separate [the app source repo (built by CI) from the deployment config repo (reconciled by the controller)], because [a config change should not rebuild the app, an app commit should not mutate prod directly, and access differs]. Model environments as [folders/overlays (or branches), base + per-env overrides]. Avoid [co-locating manifests with app code].”
Keep going with gitops
Foundation
What is GitOps, and what problem does it solve?
Foundation
What is the difference between push-based and pull-based deployment, and why does GitOps prefer pull?
Foundation
What are the core principles of GitOps?
Junior
What are Argo CD and Flux, and how do they differ?
Junior
How does drift detection and self-healing work in GitOps?
Mid
How do you promote a change from dev to staging to prod in a GitOps workflow?
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free