Server-side apply and ownership
One object, several writers
A Deployment can be maintained by a release pipeline, an autoscaler and an operator. They need not own the same settings. Server-side apply (SSA) lets clients declare the fields they intend to manage. The API server records this intent and rejects an apply that would change a field another manager owns, unless the conflict is explicitly overridden. Think of a shared document with named editors responsible for particular sections, not a lock on the entire document.
Client-side versus server-side apply
Traditional client-side apply calculates a patch using the local file, the live object and a previous configuration stored in the last-applied-configuration annotation. SSA performs its merge on the API server and tracks field sets in metadata.managedFields. Both can create or update an object. A field manager is a descriptive identity for field tracking, not an authenticated user or an authorization boundary. RBAC still controls whether the request is permitted. SSA has been stable since Kubernetes 1.22; exact client/server compatibility must be checked in a lab.
A replica ownership conflict
In the synthetic fixture, release-bot manages spec.replicas=3 and the container image. An ops-bot apply requests replicas=5. The expected result is a field conflict, with the original value unchanged. The partial manifest below is intended for an existing Deployment, not a complete creation manifest. All commands are illustrative, require an approved disposable context and are not executed here. The image registry is deliberately non-resolvable.
apiVersion: apps/v1kind: Deploymentmetadata: name: catalog namespace: api-labspec: replicas: 3Inspect before changing ownership
Inspect the manager and field-set information, then preview your intended apply. Do not copy the full observed object into a new apply request: that can claim fields you never intended to manage. The command below uses a named field manager and server dry-run; it contacts the API server but does not persist the object. In a real approved lab, a conflict is evidence that you must coordinate with the other writer, not a signal to add --force-conflicts automatically.
kubectl --kubeconfig ./approved-lab.kubeconfig --context bytemind-lab -n api-lab get deployment catalog -o yaml --show-managed-fieldskubectl --kubeconfig ./approved-lab.kubeconfig --context bytemind-lab -n api-lab apply --server-side --field-manager=ops-bot --dry-run=server -f ops-replicas.yamlShare or hand off a field
If ops-bot applies the existing value 3, both appliers can own that field. If release-bot then omits replicas from its next apply, ops-bot can remain the owner and later change it. Without another owner, omitting a previously owned field can remove it or cause defaulting. Do not assume omission means leave unchanged. In a planned autoscaler handoff, review the actual controller ownership and current desired replica count before changing the release manifest. Forced ownership transfers must be explicit, narrowly scoped and reviewed. Ordinary update and non-apply patch operations can change managed fields without an SSA conflict; field ownership is not a security barrier.
Practice with two managers
Open lab-fixtures/advanced-kubectl/ownership-cases.json. Predict the resulting value and owners for each independent case. The single-field model omits defaults, list schema, admission and migration rules. Explain why a shared field is different from an unmanaged field, and why server dry-run is not a live ownership transfer. Next: choose the appropriate patch mechanism.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Server-side apply and ownership — knowledge check
Reason about the offline API change fixtures.
Who computes the SSA merge?
release-bot owns replicas=3; ops-bot applies 5 without force. What is expected?
What happens if ops-bot applies the same value 3?
What can happen when the only owner omits a previously managed field?
Does field manager name grant permission?