Tech Interview RoomStudy guides

CI/CD

What is GitOps, and how do Argo CD or Flux work?

Advanced · 2 min read · Lesson 6 of 6 in CI/CD

GitOps principles

  1. The desired state of the system is declarative (Kubernetes manifests, Helm charts, Kustomize).
  2. It is versioned in Git: every change is a commit or pull request with review and history.
  3. Changes are pulled automatically by an agent in the cluster.
  4. The agent continuously reconciles: it compares the live state with Git and corrects drift.

How Argo CD works

  • An Application resource points to a repository path and a target cluster or namespace.
  • The application controller renders the manifests, diffs them against the cluster and shows the app as Synced or OutOfSync, Healthy or Degraded.
  • With auto-sync it applies changes; with self-heal it reverts manual kubectl changes; prune removes resources deleted from Git.
  • Sync waves and hooks order resources (for example, run a migration Job before the Deployment).
  • ApplicationSets generate applications for many clusters or environments; Argo Rollouts adds canary and blue-green.

Push vs pull

  • Push (CI runs kubectl apply or helm upgrade): simple, but CI needs cluster admin credentials and nothing corrects drift.
  • Pull (GitOps): credentials stay inside the cluster, Git is the audit log, drift is detected and corrected, and disaster recovery is "point a new cluster at the repo".

Typical flow

CI builds and pushes an image, then opens or commits a change to the config repository (bumping the image tag, often automated with Argo CD Image Updater or Renovate). Argo CD syncs it. Promotion to production is a reviewed pull request.

CI
GitHub Actions or Jenkins
↓push image
Registry
Container registry
↓PR bumps image tag
Git
🗄️ Config repo (Helm and Kustomize per env)
↓Argo CD pulls and reconciles
Cluster
Argo CD controllerKubernetes workloads

Follow-up questions interviewers ask

Try answering each one before you open it.

How do you manage secrets with GitOps if everything lives in Git?

Never commit plain secrets. Options: External Secrets Operator (Git holds a reference; the operator fetches the value from Vault, AWS Secrets Manager or GCP Secret Manager), Sealed Secrets (encrypted with a cluster public key; only the in-cluster controller can decrypt), or SOPS with KMS-encrypted values decrypted by Flux or an Argo CD plugin. External Secrets is the most common choice because rotation stays in the secrets manager.