October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

What Actually Happens When You Run `kubectl apply`

kubectl apply sends declarative configuration to the Kubernetes API. Learn what changes, how apply modes track fields, and how to preview an operation safely.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

kubectl apply reads Kubernetes object configuration and sends a request to the Kubernetes API to create or change the resources it describes. If a resource does not exist, apply creates it; if it already exists, apply reconciles it according to the selected apply mode. A successful command means the API accepted the configuration—not that the application is already running or healthy.

What happens when you run kubectl apply?

The command takes a declarative configuration—usually YAML or JSON—and uses it to request a change to cluster resources. Its broad sequence is:

As an Amazon Associate I earn from qualifying purchases.

  1. Load the configuration. You can provide a file, standard input, a directory, a URL, or a Kustomize directory. Directory processing can include subdirectories with -R. See the kubectl apply command reference for supported inputs and options.
  2. Prepare the operation. Flags can change validation, dry-run behavior, field-manager identity, or whether the command uses Server-Side Apply. Defaults and available behavior can vary by kubectl and API server version.
  3. Send the request to the API. The API receives an operation for each resource described in the input. With Server-Side Apply, the request is a create if the object is absent and a patch if it exists; this is not a general-purpose operation for every API endpoint. The Kubernetes API Concepts documentation describes the API behavior.
  4. Validate and process the object. Strict validation is the command-reference default. When supported, validation happens on the API server; otherwise kubectl can fall back to client-side validation. The --validate=strict, warn, and ignore settings affect how unknown or duplicate fields are handled.
  5. Persist the change or show a preview. A normal apply changes cluster state. Dry-run modes let you inspect a proposed operation without persisting it.

Apply is not a wholesale replacement of an object. The precise change depends on the apply mode and how fields are tracked. Nor does a successful API write prove that a workload has become ready; use workload status or rollout checks to assess that separately.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Client-side apply and Server-Side Apply compared

The key difference is how Kubernetes records intent and manages ownership of fields.

Aspect Traditional client-side apply Server-Side Apply
Where the apply logic runs kubectl prepares the changes using the configuration, the live object, and the saved prior configuration. The API server processes the apply request.
How prior intent or ownership is recorded The kubectl.kubernetes.io/last-applied-configuration annotation stores the last-applied configuration. The API server records field ownership in metadata.managedFields.
Conflict behavior The documented client-side mechanism compares configurations to determine changes; it does not use Server-Side Apply’s managed-field conflict model. A change to a field asserted by another manager normally fails with a conflict. --force-conflicts overrides it and transfers ownership.
Field manager Not the managed-field ownership mechanism used by Server-Side Apply. Identifies the workflow asserting fields; the Server-Side Apply default is kubectl.

Traditional client-side apply uses the saved annotation along with the live object and new configuration to work out changes. Server-Side Apply moves that work to the API server and tracks which manager asserts each field. The declarative configuration guide explains the annotation-based workflow; the Server-Side Apply documentation explains field ownership.

What field conflicts mean—and what happens when a field is omitted

A Server-Side Apply conflict means the requested change would alter a field that another manager also asserts. The default response is to reject the request rather than silently take over that field. Review which manager owns it and coordinate the intended change before retrying. Using --force-conflicts is an explicit ownership transfer, not simply a harmless retry.

Omitting a field from a later apply configuration can also change the object. Kubernetes checks whether another manager owns the field; if the applying manager is its only owner, the field is removed or reset to its applicable default. If multiple managers assert the same value, they can share ownership. This is why a manifest should be treated as the desired state for fields its manager controls, not as a harmless partial note.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How dry-run and diff let you preview changes

  • kubectl apply --dry-run=client prints the object that would be sent without sending it to the API server.
  • kubectl apply --dry-run=server sends a server-side request for evaluation without persisting the result.
  • kubectl diff uses Server-Side Apply in dry-run mode. It depends on API server support and the permissions needed for that request.

These modes answer different questions: client dry-run shows the locally prepared object, while server dry-run asks the API server to evaluate the request. Check the command reference for the kubectl and cluster versions in use, particularly where server-side validation or dry-run support matters.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When to use each apply mode

  • Use traditional apply when you rely on the established client-side workflow and its last-applied annotation.
  • Use kubectl apply --server-side when you want API-server-managed field ownership and conflict detection among managers.
  • Pause on a conflict to determine which workflow owns the field and whether the proposed change is intended. Force only when you deliberately want to transfer ownership.

Server-Side Apply can combine create-or-update behavior in one request and detect ownership conflicts, but it is not designed for updates that depend on the object’s current value. Choose the method based on how the resource is managed, not just on which command appears shorter.

Two cautions before applying

  • Separate API success from application health. Apply configures resources; check workload status or rollout progress to determine whether the resulting application is ready.
  • Treat prune as a separate, potentially destructive feature. The current command reference says prune is not complete and advises against using it unless you are aware of its state. Prune can delete objects missing from the supplied configuration; it is not part of the normal create-or-update behavior.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.