Skip to content
TaeyoungKim.dev

Argo CD OutOfSync: When Git and Kubernetes Live State Differ

CloudWritten 3 min readTaeyoungKim
LinkedInX

Git declares two replicas, but three are running in the cluster. Did deployment fail, or did someone make an emergency change? GitOps compares the desired state recorded in Git with the live state in the cluster. When they differ, Argo CD can display OutOfSync. Before pressing Sync, find out why the difference exists.

Which two states does GitOps compare?

The diagram shows replicas: 2 in Git and three live replicas. Syncing the cluster to Git and deciding which replica count should be kept are separate decisions.

The learning exercise registers a Guestbook application from a Git repository and syncs it manually. Here the replica numbers are hypothetical; no actual repository is changed.

yaml
# Illustrative excerpt from a Deployment in Git
spec:
  replicas: 2
LocationReplica countWhat it represents
Git configuration2The declared desired state
Live cluster3The value currently observed

The difference does not tell you which value is the right decision. If three replicas were set during an incident, the team must decide whether to keep three, update Git to three, or return to two. Argo CD can show the discrepancy; it cannot decide the product requirement or incident response for you.

What changes when you press Sync?

Synchronization attempts to make live resources match the desired Git manifests. In this example, applying the declared two replicas could reduce the current three to two. Pressing Sync without checking whether the third instance is needed may undo an emergency mitigation.

With manual sync, a reviewer can inspect the diff and choose when to apply it. Automated sync can react to eligible differences, but its behavior depends on policy. In particular, Argo CD's automated sync documentation says live-only changes do not trigger auto-sync by default; selfHeal controls that behavior. Automatic deletion of resources removed from Git is a separate prune option. Check the application's current settings instead of assuming all OutOfSync states will be reconciled the same way. Fields changed by another controller may also need special treatment.

How should you investigate a difference?

First confirm which Git branch, revision, and path Argo CD is tracking. Next read the resource and field shown in the diff. Finally determine whether a deployment, autoscaler, or manual incident action changed that field. Once you know the cause, choose whether to update Git, revert the cluster, or manage an expected difference explicitly.

In production, a sync can scale down or delete resources depending on the requested changes and options. Review its scope and recovery path first. A green status matters less than the service actually matching the intended state. This article explains the decision process; it does not claim production incident experience from a learning exercise.

Key takeaways: OutOfSync is a difference signal

OutOfSync means the declared Git state and observed cluster state differ. Before syncing, check which field changed, why it changed, and what applying Git would remove or reduce. Then decide whether Git or the live state needs to change.

Author

TaeyoungKim

Connecting technical foundations with implementation, verification, and production decisions.

#Kubernetes#GitOps#Argo CD#OutOfSync#Sync

Read next