Prev Next

DevOps / GitOps Interview Questions

How do you use Kustomize overlays in a GitOps repository?

Kustomize is a template-free Kubernetes manifest customisation tool built into kubectl and natively supported by both Argo CD and Flux. The overlay pattern keeps shared resource definitions in a base/ directory and accumulates environment-specific differences in per-environment overlays/ directories, avoiding duplication while keeping diffs small and reviewable.

A base kustomization.yaml simply lists the resources it manages:

# apps/my-app/base/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - deployment.yaml
  - service.yaml
  - hpa.yaml

A production overlay then references the base and applies patches:

# apps/my-app/overlays/prod/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - ../../base
namePrefix: prod-
commonLabels:
  env: production
images:
  - name: my-app
    newName: registry.example.com/my-app
    newTag: v2.1.0
patches:
  # Strategic merge patch: increase replicas for prod
  - path: replica-patch.yaml
  # JSON 6902 patch: set a specific env var
  - patch: |-
      - op: replace
        path: /spec/template/spec/containers/0/env/0/value
        value: "production"
    target:
      kind: Deployment
      name: my-app

Useful Kustomize fields in overlays: namePrefix / nameSuffix to namespace resource names per environment; commonLabels / commonAnnotations to tag all resources; configMapGenerator and secretGenerator to create environment-specific ConfigMaps or Secrets. Argo CD and Flux both run kustomize build on these directories before applying, so the raw YAML you store in Git is never the final manifest — patches are applied at sync time.

What does a Kustomize strategic merge patch do compared to a full resource replacement?
Which kustomization.yaml field prepends a string to the names of all resources in a Kustomize overlay?

More Related questions...

What is GitOps and what core principles does it define? How does GitOps differ from traditional CI/CD pipelines? What is the 'single source of truth' principle in GitOps? What are the two GitOps deployment models: push-based vs pull-based? What is a GitOps operator and what role does it play? What is declarative infrastructure and why does GitOps require it? How does GitOps improve security and auditability compared to script-based deployments? What Git branching strategies are commonly used with GitOps? What is drift detection and how does a GitOps operator handle drift? What is the difference between GitOps and Infrastructure as Code (IaC)? What is Argo CD and how does it implement GitOps? How does Argo CD's sync process work — desired state vs live state? What are Argo CD Applications and ApplicationSets? How do you structure a GitOps repository — app-of-apps, environment folders, overlays? What is Flux CD and how does it differ from Argo CD? How does Flux's source-controller and kustomize-controller work together? How do you manage secrets in a GitOps workflow — Sealed Secrets, SOPS, External Secrets Operator? How do you handle multiple environments (dev/staging/prod) in a GitOps repo? How does image automation work in Flux for continuous delivery? What are Argo CD sync policies — automated vs manual — and sync waves? How do you roll back a deployment using GitOps? How do you integrate GitOps with a CI pipeline — separation of concerns? What is progressive delivery and how does it relate to GitOps — Argo Rollouts, Flagger? How do you handle Helm charts in a GitOps workflow? How do you use Kustomize overlays in a GitOps repository? How do you implement multi-cluster GitOps at scale? How does Argo CD handle RBAC and multi-tenancy? What are the Argo CD app-of-apps and ApplicationSet patterns and when do you use each? How do you implement GitOps for infrastructure provisioning with Crossplane and Cluster API? How do you observe and alert on GitOps sync failures in production? How do you manage database schema migrations in a GitOps workflow? How do you implement policy enforcement in a GitOps pipeline — OPA/Gatekeeper, Kyverno? What are the limitations and anti-patterns of GitOps? How do you migrate an existing deployment pipeline to GitOps? How does GitOps fit into a platform engineering strategy?
Show more question and Answers...


Comments & Discussions