Application synchronization options

更新时间:
复制 MD 格式

Argo CD lets you fine-tune how resources are synchronized to a cluster. Each sync option controls a specific behavior during the sync process—choose the ones that match your deployment requirements.

For the full upstream reference, see Argo CD sync options.

Configure a sync option

Set sync options at the Application level in spec.syncPolicy.syncOptions, or at the individual resource level using the argocd.argoproj.io/sync-options annotation.

Application level:

apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
  syncPolicy:
    syncOptions:
    - <SyncOptionName>=true

Resource level:

metadata:
  annotations:
    argocd.argoproj.io/sync-options: <SyncOptionName>=true

Sync options

Prune

Deletes the subresources of an application from the cluster when they are no longer present in the Git repository.

Use this option when you want Argo CD to enforce the Git repository as the single source of truth—any subresource removed from Git is also removed from the cluster.

Validate

Controls whether Argo CD validates resources before applying them.

Set to false to disable validation for resources that fail schema validation but are otherwise valid (for example, custom resources with schemas not registered in the cluster).

CreateNamespace

Automatically creates the target namespace in the cluster if it does not already exist during synchronization.

ApplyOutOfSyncOnly

Synchronizes only resources in the OutOfSync state, skipping resources that are already in sync.

Use this option to speed up syncs for large applications where most resources have not changed.

PruneLast

Delays resource pruning until the final stage of synchronization—after all other resources have been deployed and are running.

Use this option to avoid cascading failures when dependent resources must be running before their owners are removed.

RespectIgnoreDifferences

During synchronization, ignores the fields listed in spec.ignoreDifferences when comparing the live state against the desired state in Git.

ServerSideApply

Applies changes using kubectl apply --server-side instead of the default client-side apply.

ServerSideApply can also be used to patch existing resources by providing a partial YAML.

ServerSideApply can be set at the Application level to apply to all resources, or at the resource level to target individual resources.

PrunePropagationPolicy

Controls how Kubernetes propagates deletion to dependent resources when pruning. Valid values:

ValueBehavior
backgroundDeletes the owner object first; dependent objects are deleted after the owner object.
foregroundDeletes dependent objects first, then deletes the owner object.
orphanDeletes only the owner object; dependent objects remain in the cluster as orphans.

Default: foreground.

Replace

Warning

This option is destructive. During synchronization, resources are deleted and recreated using kubectl replace/create, which can cause downtime for your application. Use only when kubectl apply is not suitable.

Uses kubectl replace/create instead of kubectl apply to synchronize resources.

What's next