Back to articles

GitOps day two: what Flux and Argo CD don't tell you in the docs

Installing Flux or Argo CD is the short part. This article covers what comes after: who wins when the HPA and Git disagree, how pruning deletes things you meant to keep, ordering CRDs for a rebuild, what Git doesn't contain when the cluster is gone, and how to make an emergency change without fighting the controller.

Installing Flux or Argo CD is the short part. The controller syncs a repository, and the team agrees that Git is now the source of truth. The questions that decide whether that holds come later. Who wins when the HorizontalPodAutoscaler and Git disagree about replicas? What gets deleted when someone moves a directory? How do you stop a bad release at night when the controller reverts every kubectl change? What do you rebuild from if the cluster is gone?

The title is a little unfair: nearly all of this is in both projects' documentation, spread over many reference pages.

Who this is for: platform engineers who already run Flux or Argo CD, or are about to, and are responsible for what happens after the first sync.

What you walk away with: both tools' defaults for drift, pruning and ordering side by side, a break-glass procedure for each, and a list of what Git doesn't contain when you need to rebuild.

Feature names were checked against the documentation of Argo CD v3.6.1 and Flux v2.10.0, current in November 2026. Most claims were then run at those versions on one cluster (GKE 1.36.4, 17 November 2026); the flux CLI, flux bootstrap, secrets tooling and webhooks were not.

Two tools, different defaults

Question Argo CD (Application) Flux (Kustomization)
Is a manual change to a managed field reverted? Not by default. Only with selfHeal: true, or by the next sync, which applies the manifests again. Yes, at the next reconciliation.
Are resources removed from Git deleted? Not by default. Only with prune: true. spec.prune is a required field; you choose.
What happens when the managing object is deleted? Its resources stay, unless the Application has the resources-finalizer.argocd.argoproj.io finalizer. argocd app delete and the UI cascade by default. With prune: true, everything it applied is deleted.
How often is the cluster compared with Git? timeout.reconciliation, 120 seconds by default plus up to 60 seconds of jitter spec.interval, per object

Flux HelmReleases differ from Kustomizations: drift detection is off unless you set spec.driftDetection.mode to warn or enabled.

Drift: who wins

Others write to a live object besides your GitOps controller: the HPA sets spec.replicas, mutating webhooks inject sidecars and defaults, cert-manager fills in caBundle fields. If Git sets those fields too and the controller enforces them, the two sides keep overwriting each other.

Replicas and the HPA

The first fix is the same for both: don't put the field in Git. The Flux FAQ says "you'll have to omit the spec.replicas field" when an HPA changes the replicas in-cluster.

Removing the field from a running Deployment is a hazard of its own. The Kubernetes documentation warns that the field defaults to 1, so removing it "may incur a one-time degradation of Pod counts", and describes how to avoid that. In my test both tools dropped a three-replica Deployment to 1 until the HPA scaled it back. The upcoming HPA tuning article has the procedure.

Omitting the field isn't always possible, for example when a Helm chart renders it unconditionally. A Flux HelmRelease with drift detection on accepts JSON pointers such as /spec/replicas in spec.driftDetection.ignore. Argo CD offers ignoreDifferences, with a catch:

apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
  ignoreDifferences:
  - group: apps
    kind: Deployment
    jsonPointers:
    - /spec/replicas
  syncPolicy:
    syncOptions:
    - RespectIgnoreDifferences=true

ignoreDifferences on its own only affects the comparison. The application shows as Synced, but the Argo CD docs note that "during the sync stage, the desired state is applied as-is". So the next sync, triggered by any unrelated commit, resets replicas to the value in Git. RespectIgnoreDifferences=true makes the sync leave the field alone as well, but only for resources that already exist in the cluster.

Fields owned by other controllers

For fields written by webhooks and controllers, both tools build on server-side apply and its field ownership.

In Argo CD, ignoreDifferences takes jsonPointers, jqPathExpressions (for list items) or managedFieldsManagers, which ignores every field owned by a named manager such as kube-controller-manager. The ServerSideApply=true sync option switches the apply itself. The documentation says Argo CD then runs kubectl apply --server-side --force-conflicts, so conflicts with other field managers are resolved in Argo CD's favour, not reported.

In Flux, the behaviour is set per resource with an annotation in the manifest:

kustomize.toolkit.fluxcd.io/ssa Behaviour
Override (default) Git wins. Manual edits are reverted.
Merge Fields added by others are kept. Fields that are in Git still win.
IfNotPresent Applied only if the object doesn't exist yet.
Ignore Never applied, even though it is in the source.

The Flux docs name the case for IfNotPresent: Secrets and ValidatingWebhookConfigurations managed by cert-manager, which Flux creates and other controllers then mutate. Merge has a documented limit: atomic lists such as .spec.tolerations have one owner, so changes to them are reverted anyway.

Every ignored field is a field Git no longer describes.

Pruning: the delete you didn't mean

Pruning removes cluster resources that are no longer in Git. With it, a mistake in Git becomes a deletion in production: renaming a directory, moving a resource to another Application or Kustomization, or a templating error that renders nothing all look like "these resources were removed".

Guard Argo CD Flux
Never delete this resource Annotation argocd.argoproj.io/sync-options: Prune=false Annotation or label kustomize.toolkit.fluxcd.io/prune: disabled
Ask before deleting Prune=confirm, and Delete=confirm for deletion of the Application None in the Kustomization spec
Keep when the managing object is deleted Delete=false spec.deletionPolicy: Orphan
Empty render protection Automated sync refuses to prune to zero resources unless allowEmpty: true None: a path that exists but holds no manifests builds to zero objects, reports Ready and prunes everything (tested). A missing spec.path fails the build.
Delete after everything else PruneLast=true Not applicable

Set the first guard on anything whose deletion loses data or takes down more than itself: Namespaces, PersistentVolumeClaims, CRDs. The Argo CD documentation suggests Prune=confirm for Namespaces; the sync then stays in Syncing until someone confirms. The Flux documentation recommends its annotation for "Namespaces, PVCs and PVs".

Deleting a Flux Kustomization deletes its resources. With prune: true and the default deletionPolicy of MirrorPrune, removing the Kustomization object removes everything it applied. Reorganising your Flux repository is therefore a delete operation unless you plan it. The Flux FAQ has procedures for moving resources between directories and for renaming a Kustomization.

An Argo CD app of apps behaves the same way. The documented pattern gives each child Application the resources finalizer and prunes from the parent, so removing a child's manifest deletes that child's workloads.

CRDs take their custom resources with them. If a CRD is pruned, Kubernetes deletes every object of that kind.

Ordering: CRDs before the things that use them

A repository that applies cleanly to an existing cluster can fail on an empty one, where the CRDs and their controllers don't exist yet.

Argo CD orders resources inside an Application with sync waves: the annotation argocd.argoproj.io/sync-wave takes an integer, lower numbers are applied first, negative numbers are allowed and the default is 0. Pruning runs in reverse wave order. When a CRD is in the same sync as its custom resources, Argo CD skips the dry run for them. When it isn't, the sync fails with the server could not find the requested resource unless you set SkipDryRunOnMissingResource=true.

Flux orders between Kustomizations; the spec has no per-resource ordering. spec.dependsOn makes one Kustomization wait until another is Ready:

apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: certs
  namespace: flux-system
spec:
  dependsOn:
  - name: cert-manager
  interval: 10m
  path: ./certs
  prune: true
  sourceRef:
    kind: GitRepository
    name: flux-system

Ready only means something if the dependency checks health. Set wait: true or list healthChecks on the cert-manager Kustomization, otherwise it is ready as soon as its manifests are applied, before the controller's webhook is serving.

Flux HelmReleases have one more setting: spec.install.crds and spec.upgrade.crds, with the values Skip, Create and CreateReplace. The default is Create on install and Skip on upgrade, so CRDs are not updated on chart upgrades unless you set CreateReplace.

Secrets

Secrets can't be in Git in plain text, and a base64-encoded Secret manifest is plain text. Either Git holds an encrypted form that something in the cluster decrypts (Sealed Secrets, or SOPS, which Flux's kustomize-controller decrypts via spec.decryption), or Git holds only a reference and an operator fetches the value from an external store (External Secrets Operator, the Secrets Store CSI Driver). The Argo CD documentation recommends populating secrets on the destination cluster and cautions against injecting them during manifest generation with a plugin, among other reasons because Argo CD "stores generated manifests in plaintext in its Redis cache".

Either way, a key or a credential stays outside Git.

Bootstrap and disaster recovery

Check "everything is in Git" against what a new, empty cluster needs before the controller can do anything.

Needed for a rebuild In Git?
Workload manifests Yes
The GitOps controller's own installation Only if you put it there
Credentials for the controller to read Git No
Decryption key (SOPS age key, Sealed Secrets private key) or access to the external secret store No
Data in PersistentVolumes No
Objects created by controllers at runtime: issued certificates, generated passwords No
Argo CD state: clusters, repository credentials, projects not declared in Git No

flux bootstrap installs the controllers, commits their manifests to the repository and configures Flux to update itself from Git. The documentation calls it idempotent and adds that it upgrades controllers already present "if needed", so run it with the CLI version you intend to have on the cluster. A rebuild is then bootstrap, restore the decryption key, wait, and it works only if the dependsOn ordering is right.

Argo CD's documented disaster recovery is argocd admin export and argocd admin import, which dump and restore all Argo CD data. The alternative is to declare Applications, projects and repositories as manifests in Git and treat Argo CD itself as the one thing installed by hand or by your provisioning tool.

Without the decryption key, every encrypted secret in Git is unreadable. Back the key up outside the cluster and outside the repository.

When the controller is down

If the GitOps controller stops, nothing new is deployed and drift isn't corrected, but running workloads keep running. Problems start when the controller is on the path to its own recovery: it manages the CNI plugin, the admission webhooks, or itself, and a bad commit to one of those leaves it unable to apply the fix. For that case someone needs working kubectl access with enough rights, and a written procedure that has been rehearsed.

Emergency manual changes

A controller that enforces Git treats your kubectl fix as drift and reverts it. The intended route is a commit, usually a revert. Sometimes that isn't available: Git or the pipeline is down, or you need to hold a state while you investigate. The procedure is the same in both tools: pause, change, record, restore.

Flux:

# Pause one Kustomization: no new revisions, no drift correction
flux suspend kustomization <name> -n flux-system

# ...make the change with kubectl...

# After the fix is in Git
flux resume kustomization <name> -n flux-system

For a single object, annotate it in the cluster with kustomize.toolkit.fluxcd.io/reconcile: disabled. Flux then neither applies changes to it nor prunes it, and a skipped prune is never retried.

Two things can defeat the pause. If the Kustomization object is itself applied from Git and Git sets suspend: false, the Flux docs warn that a manual patch "would be overwritten by the declared state in Git"; leave the field out of Git. Even then Flux reverted a plain kubectl patch; use flux suspend, which held. And a HelmRelease is reconciled by helm-controller, which needs its own flux suspend helmrelease.

Argo CD: switch off automation for the Application, either by removing spec.syncPolicy.automated or by setting spec.syncPolicy.automated.enabled: false (a field added in v3.1). Three documented caveats:

Argo CD also has sync windows, which block syncs on a schedule and can still allow manual ones.

A suspended Kustomization or a disabled sync policy is drift that nobody is alerted about. Give every pause an owner and an end time, and alert on objects that stay suspended.

The controller is the most privileged thing in the cluster

In a default installation both tools hold cluster-admin; the Argo CD security page and the Flux multi-tenancy guide say so. Two consequences follow.

Write access to the repository is write access to the cluster. Branch protection, required reviews and signed commits on the GitOps repository are cluster access controls and belong in the same reviews as your RBAC.

The controller itself is a target. It renders untrusted input (Helm charts, Kustomize bases, plugins) and holds credentials for every cluster it manages. The repo-server hardening article covers this for Argo CD. In shared clusters, restrict what each tenant's objects may do. Neither tool does so by default.

Without those, a team that can commit to its own path can deploy to someone else's namespace. The RBAC audit article helps you list the bindings the controller holds.

Checklist

  1. Drift policy is decided per tool: selfHeal in Argo CD, driftDetection on Flux HelmReleases.
  2. spec.replicas is absent from Git wherever an HPA exists, or ignored for both diff and sync.
  3. Every ignore rule says which controller owns the field.
  4. Namespaces, PVCs and CRDs carry a no-prune annotation.
  5. Nobody deletes or renames a Kustomization or Application without checking what goes with it.
  6. CRDs and their controllers come before the resources that need them, with a health check in between.
  7. Decryption keys and Git credentials are backed up outside the cluster and the repository.
  8. A rebuild on an empty cluster has been rehearsed.
  9. The break-glass procedure has an owner and includes un-pausing.
  10. Tenants are restricted by project or service account, and the repository's branch protection matches the access it grants.