✦ For everyone, free.

Practical knowledge for real and everyday life

Home

Kubernetes Server Side Apply Behavior

Kubernetes Server Side Apply Behavior updates resources dynamically by applying changes directly to the API server, enhancing automation and management efficiency.

Kubernetes Server Side Apply Behavior is the practical, operator-facing experience of actually using Server-Side Apply day to day — invoking it through kubectl apply --server-side, encountering and resolving field-ownership conflicts, migrating existing objects that were previously managed some other way, and understanding how it behaves differently from client-side apply in situations an operator is likely to actually hit. Where the Server-Side Apply model describes the underlying field-tracking mechanism, this behavior is concerned with what actually happens, and what an operator actually needs to do, when that mechanism meets real-world manifests and real-world object history.


Invoking Server-Side Apply

The --server-side Flag

kubectl apply --server-side switches from the default client-side three-way merge to Server-Side Apply, submitting the manifest as an apply-patch request rather than computing a merge locally; the field manager identity defaults to kubectl, though it can be overridden explicitly when multiple distinct tools or pipelines need to be distinguished as separate owners of the same objects.

Behavioral Differences an Operator Notices Immediately

The most immediately noticeable difference is that Server-Side Apply can fail with a conflict error where client-side apply would have silently succeeded (and silently overwritten another actor's change), which is by design, but does mean operators accustomed to client-side apply's more permissive behavior need to adjust their expectations for what a failed apply now means.


Encountering and Resolving Conflicts

Reading a Conflict Error

A Server-Side Apply conflict error names the specific field in dispute and which field manager currently owns it, giving the operator enough information to decide the correct resolution without needing to inspect the object's full managedFields separately, though doing so can still help when the conflict involves a less obvious nested field.

Resolution Paths

An operator facing a conflict has three practical options: remove the conflicting field from the manifest being applied if that field genuinely belongs to another actor, coordinate to have the other actor stop managing that field, or apply with --force-conflicts to take over ownership explicitly, a choice that should be made deliberately rather than reflexively, since force-taking ownership can disrupt whatever the other field manager was doing with that field.


Migrating Existing Objects

First Apply Against a Non-Server-Side-Apply-Managed Object

An object created via kubectl create, kubectl apply in client-side mode, or direct API calls has no prior Server-Side Apply field-ownership history; the first Server-Side Apply against such an object typically needs --force-conflicts (or an equivalent force flag) because existing fields are attributed to a default, unnamed manager that the new field manager has not yet reached agreement with, even though no other active tool is genuinely contesting those fields.

Steady State After Migration

Once an object has been successfully brought under Server-Side Apply management, subsequent applies from the same field manager proceed without needing force, since ownership has now been established cleanly; the force flag is generally a one-time requirement for the initial transition rather than an ongoing necessity.


Interaction With Other Tools

Helm and Server-Side Apply

Helm's own object management historically used an approach analogous to client-side apply's last-applied-configuration tracking, and mixing Helm-managed objects with separately Server-Side-Applied changes to the same fields can produce the same category of conflicts or silent overwrites seen when mixing any two update strategies inconsistently, making it important to be deliberate about which fields, if any, are managed outside of Helm's own release lifecycle.

Autoscalers and Externally Adjusted Fields

Because the Horizontal Pod Autoscaler adjusts a Deployment's replica count as its own field manager, a Server-Side Apply that includes an explicit replicas value in its manifest will conflict with or overwrite the autoscaler's most recent adjustment on every apply; the correct practice is to omit the replicas field entirely from manifests applied to autoscaled Deployments, leaving that field exclusively under the autoscaler's ownership.