Course contentsShow
← Cloud and Infrastructure
Lesson 1896 of 2,98940. ArgoCDFree lesson

Automated Sync Policies

Configuring automatic synchronization with prune, self-heal, and sync options.

Automated Sync Policies

What you'll learn: How to configure ArgoCD to automatically synchronize your Git repository with your Kubernetes cluster using prune, self-heal, and advanced sync options.

Why Automated Sync Matters

Manual synchronization requires human intervention every time your Git repository changes. Automated sync policies let ArgoCD continuously reconcile your cluster state with Git—the heart of GitOps—without waiting for someone to click "Sync."

Core Sync Options

When you enable automated sync in your Application spec, you can configure three critical behaviors:

Prune

Automatically removes resources from the cluster that no longer exist in Git. Think of it as garbage collection: if you delete a Deployment from your repository, ArgoCD will delete it from the cluster too.

Self-Heal

Automatically reverts manual changes made directly to the cluster. If someone runs kubectl edit and modifies a resource, self-heal detects the drift and restores Git's version. This enforces Git as the single source of truth.

Sync Options

Fine-tune synchronization behavior with options like:

  • CreateNamespace=true — automatically create target namespaces
  • PruneLast=true — delete resources after deploying new ones
  • RespectIgnoreDifferences=true — honor field exclusions

Configuration Example

spec:
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
      allowEmpty: false
    syncOptions:
      - CreateNamespace=true
      - PruneLast=true

This configuration creates a fully automated GitOps loop: changes in Git trigger syncs, removed manifests are pruned, and manual cluster edits are reverted.

Key Takeaway: Automated sync policies with prune and self-heal enable true continuous deployment by maintaining strict GitOps discipline—your cluster continuously converges toward Git's declared state without manual intervention.