DevOpsInterviewPrep logo
← ☸️ Containers & Kubernetes
Foundational

Kubernetes server-side apply field ownership: resolve conflicts without stealing control

Explain field managers, apply conflicts and ownership transfer in Kubernetes. Diagnose a replicas conflict between a deployment manifest and an autoscaler before forcing a write.

TL;DR: Server-side apply records which manager owns fields and detects conflicting changes. Resolve a conflict by deciding who should control the field, then adjust the competing declarations. Forcing a write transfers ownership; it does not resolve the disagreement between controllers.

The API tracks intent at field level

A resource can have several legitimate writers. A delivery system manages its Pod template, while an autoscaler manages desired replica count. Server-side apply lets clients declare fields they intend to manage and records ownership in metadata.managedFields. A conflicting apply refuses a change another manager owns unless the applying client explicitly forces it.

The Kubernetes apply reference explains conflicts and ownership. The field-manager name identifies a client workflow; it is not an authenticated security principal or RBAC grant. Authorization remains a separate API decision.

rendering diagram…

Work a replicas conflict

In this teaching case, Git contains spec.replicas: 3, while the autoscaler has set the live Deployment to seven replicas. Delivery applies the manifest and receives an ownership conflict. Start with the field named in the error and inspect the relevant managers, their operations and the controller configuration. Do not classify every field change as unwanted drift.

If the autoscaler is intended to own steady-state scaling, stop declaring that value in the delivery configuration using a reviewed ownership handoff. Removing a field from an apply declaration can relinquish ownership and, when no other manager owns it, can remove or reset that field. Verify the resulting plan and controller behavior in a disposable workload before applying the handoff to production.

ActionMeaningRisk to examine
Inspect managed fieldsIdentify recorded field responsibilityManager name is not user identity
Remove a field from intentRelinquish its managementField may disappear when no owner remains
Force conflicting applyClaim the field and overwrite conflictAnother controller may immediately write back
Change controller policyResolve who should drive the valueCoordination needed during handoff

Keep diagnosis read-only first

On an authorized cluster, inspect the object including managed fields with kubectl get deployment <name> -n <namespace> -o yaml --show-managed-fields. Compare the field path in the conflict with the intended controller. The placeholders require a real target; this command is an inspection plan, not a local lab.

Review list/map merge behavior for the resource schema, especially custom resources. Ownership can apply to individual entries or larger atomic fields depending on schema. A successful experiment on a Deployment does not establish identical behavior for an operator's CRD.

A forced apply can be justified during an intentional ownership transfer when the prior writer is disabled or coordinated and the target value is reviewed. Record why that transfer is safe and verify that the field remains stable after reconciliation. Repeating --force-conflicts in every delivery run hides contention until a controller or human loses an important change.

Self-check: the API accepts a forced replica write, but replicas change again a minute later. Did apply fail? Not necessarily. Another active reconciler may have written its desired value. Resolve the control policy and observe subsequent reconciliation.

Practice the autoscaler conflict alongside the control-loop model.

RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS