Skip to content

Lesson 8 of 9 · 25m

Debugging Reconciliation Incidents

Triage source, build, apply, health, and controller-ownership failures in order instead of restarting everything and hoping convergence returns.

The first rule of a GitOps incident is: do not restart the controller just because the application is red. Controllers are usually honest reporters. Restarting them can erase useful state, delay reconciliation, and convince everyone the problem is transient when it is structural. Debug the pipeline in the order truth flows: source, render, apply, health, external side effects.

Build a failure ladder

Debug in order: source access, render, API admission, resource health, competing field ownership, then application runtime. Each rung has distinct evidence. Skipping to pod restarts at the last rung is how teams spend an hour treating symptoms.

Flux evidence trail

flux get sources all -A
flux get kustomizations -A
flux describe kustomization apps
flux logs --since=30m
kubectl -n flux-system get events --sort-by=.lastTimestamp

A source failure often means credentials, SSH host keys, branch names, network policy, or proxy behavior. A build failure often means missing files, bad bases, or a kustomize version behavior change. An apply failure means the API server rejected the object or RBAC denied it.

Read exact messages. validation failed, server-side apply conflict, namespace terminating, and no matches for kind are not interchangeable.

Argo CD evidence trail

argocd app get checkout-api --hard-refresh
argocd app diff checkout-api
kubectl -n argocd logs statefulset/argocd-application-controller --since=30m
kubectl -n checkout get events --sort-by=.lastTimestamp

In the UI, inspect resource-level sync results before clicking sync again. Argo often records precisely which object failed and why. A red application tile is not a diagnosis.

Common failure shapes

no matches for kind usually means a CRD is missing or the API version changed. field is immutable often appears when replacing Service cluster IPs, Job selectors, or StatefulSet identity fields. server-side apply conflict means another manager owns the field. finalizer hangs mean deletion is blocked by a controller, missing dependency, or dead cleanup logic.

Controllers fighting over fields

A service mesh, autoscaler, admission webhook, cloud controller, or security operator may mutate resources after GitOps writes them. Use managed fields to identify the writer:

kubectl get deploy checkout-api -n checkout -o json   | jq '.metadata.managedFields[] | {manager, operation, fieldsV1}'

The fix is not to pick the strongest controller. The fix is to declare ownership. Either Git owns the field, another controller owns it and GitOps ignores it, or the design is wrong.

Deletion incidents are special

If a namespace is stuck Terminating, look at finalizers:

kubectl get ns checkout -o jsonpath='{.spec.finalizers}'
kubectl api-resources --verbs=list --namespaced -o name | xargs -n1 kubectl get -n checkout 2>/dev/null

Do not strip finalizers blindly. They often protect external resources such as load balancers, DNS records, or cloud volumes. Removing the finalizer may orphan real infrastructure while making Kubernetes look clean.

Field notes

  • Capture failing manifests and events before remediation; evidence disappears quickly in active systems.
  • Synced is not a service-level objective. Users can still be down.
  • A controller crashloop is often caused by the resource it is trying to manage; restarting it changes nothing.
  • Rate-limited API servers can turn a sync storm into a control-plane outage.
  • Write the incident in terms of control-plane failure versus workload failure. The fixes and ownership differ.

Was this lesson helpful?

Sign in to rate