What is GitOps, and how do Argo CD or Flux work?
GitOps principles
- The desired state of the system is declarative (Kubernetes manifests, Helm charts, Kustomize).
- It is versioned in Git: every change is a commit or pull request with review and history.
- Changes are pulled automatically by an agent in the cluster.
- The agent continuously reconciles: it compares the live state with Git and corrects drift.
How Argo CD works
- An
Applicationresource 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
kubectlchanges; 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 applyorhelm 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.