Skip to navigation

Kubernetes Server-Side Apply: Ownership Checks for Claude Code

In short: Review server-side apply ownership and manifest diffs before Claude Code changes shared Kubernetes objects.

Published 17 min read
On this page

Direct answer

Server-side apply lets an agent change part of a Kubernetes object without rewriting the whole thing, and that partial-write power is exactly why field ownership needs a review before Claude Code touches a shared object. Every field an agent applies carries a manager identity, and once the agent owns a field, a controller or another team can no longer update it without a conflict. Review the field-level ownership, not just the resource-level diff, and keep the apply decision separate from the agent that prepared it.

The concrete win is that a reviewer can see which fields Claude Code would take over before the cluster write happens. The concrete loss is that a clean client-side diff says nothing about server-side conflicts, because the conflict is decided at apply time against live field ownership. The practical rule is to scope the agent to a namespace and to fields it genuinely owns, and to treat admission acceptance as a gate rather than a safety verdict. A manifest generated from Terraform rather than hand-written raises the same ownership question at plan time, which the Terraform plan review gates guide covers.

Why a shared object is where agents cause damage

A shared object is one that more than one system writes. A Deployment touched by an autoscaler, a ConfigMap read by a platform controller, an Ingress annotated by a service mesh. When an agent applies to a shared object, the question is not only “what changed” but “which system now owns each changed field.”

Three incidents follow from skipping that question. A controller stops reconciling a field because an agent took ownership and now every reconcile conflicts. A human edit disappears because the agent re-applied its own value on the next run. An agent overwrites a field a security controller set deliberately, and the change looks like a routine diff in review.

None of these show up in a resource-level diff. They show up in field ownership, which is the whole reason this post exists. The same review-before-deny instinct applies to admission policy, and the policy-as-code audit-before-deny guide covers how to make the gate visible before a write lands.

Why Field Ownership Matters

Server-side apply tracks which manager owns which field on an object. When a manager applies, the API server records that manager as the owner of the fields it set. A field can have one owner at a time, and a second manager trying to change an owned field produces a conflict unless it explicitly takes ownership.

Official, F010: Kubernetes server-side apply uses a manager identity, and kubectl sets that identity to kubectl by default.

That default is the trap for agent workflows. An agent that applies through kubectl without setting --field-manager writes as kubectl, which is the same manager identity every human kubectl user on the team shares. Ownership becomes ambiguous: an agent’s field and a colleague’s field are indistinguishable in the ownership record.

Derived, F012: a shared object should be reviewed for field ownership before an agent applies changes. This is a recommended workflow built from server-side apply semantics, not a guarantee any tool provides.

Managed field group Owning system Review question
Fields the agent sets Claude Code session Should the agent own these permanently?
Fields a controller reconciles Platform controller or operator Will the agent’s write conflict with reconcile?
Fields humans edit by hand Named engineers Does an agent takeover break the manual workflow?
Fields a mutating webhook sets Admission chain Does the agent’s value survive or get overwritten?

Read the controller row as the most common production conflict. An agent that owns a field a controller needs to manage does not just cause a one-time conflict; it can stop the controller from doing its job on every reconcile.

Evidence map showing a server-side apply recording field ownership per manager, with a controller, human kubectl users and an agent all writing the same shared object.
Editorial evidence map based on F010 and F012. The important diff is not only what changed, but which system now owns each field. Labels are the post author’s.

Manager Identity

A manager identity is a string that names who is applying. Setting it explicitly is the cheapest control in this post and the one most often skipped.

Give each automation its own manager name. An agent that applies as claude-code-agent rather than kubectl produces an ownership record you can actually read later. When a conflict appears, the manager field tells you whether the agent, a controller, or a human owns the disputed field.

Official, F010 caveat: the canonical server-side apply reference was not fetched in the research pass behind this post, so verify the current wording on manager identity and conflict behavior against the live documentation before relying on a fine detail. The default-kubectl behavior is the documented point this post builds on.

bash
  # give the agent its own manager identity
kubectl apply --server-side --field-manager=claude-code-agent -f manifest.yaml
# list which managers own fields on a shared object
kubectl get deployment api -o yaml --show-managed-fields

The --show-managed-fields flag is how a reviewer sees ownership before and after. Without it, the ownership record is invisible in a normal diff.

Shared Object Risks

Shared objects fail quietly because ownership changes do not announce themselves. The risk categories below are ordered by how often they bite.

Risk How it appears Detection
Agent takes a controller-owned field Controller logs apply conflicts Ownership diff shows agent as new owner
Agent overwrites a manual edit Human change reverts on next agent run Compare applied value to reviewed intent
Agent and webhook fight Value oscillates across applies Ownership record plus admission logs
Two agents share kubectl identity Ownership record is ambiguous Manager field reads kubectl for both
Agent applies to an object it does not own Conflict or unintended field takeover Pre-apply ownership check

The fourth row is the reason manager identity matters even when nothing else changes. Two automations writing as kubectl cannot be told apart after the fact, which makes every later ownership dispute harder to resolve. Treating an unowned automation identity the same way you would treat an unowned human access is the instinct behind access recertification for agent identities, and the blast-radius reasoning behind why a shared identity matters is covered by NetworkPolicy blast radius reviews.

Admission adds a second layer. Official, F011: Kubernetes Pod Security Standards define Privileged, Baseline and Restricted profiles with different restriction levels. The standards define requirements, and enforcement depends on how admission is configured in the cluster. A Pod Security Admission configuration decides whether a manifest is accepted, and acceptance is not the same as runtime safety. The Pod Security admission gate reviews guide covers that gate in detail, and the broader set of infrastructure threat model boundaries is a useful frame for deciding which objects count as shared in the first place.

Manifest Diff Review

A reviewer evaluating an agent’s proposed apply needs two diffs, not one. The resource diff shows what the object becomes. The field-ownership diff shows who owns each field afterward.

Start with the object-level review any manifest change needs: does the change match the request, are selectors and labels stable, and are resource requests and limits sensible. Then add the server-side specific question: which fields would this apply take ownership of, and does any of them already belong to a controller or a webhook?

Manifest change Admission risk Required approval
New field on an agent-owned object Low, if object is agent-scoped Namespace owner
Field on a controller-reconciled object Conflict with reconcile loop Platform owner
Pod security relevant field Admission may reject or mutate Security reviewer
Change to a shared ConfigMap or secret Breaks other consumers All consumer owners
Selector or label change Can detach controllers Platform owner plus service owner

The selector row is worth slowing down for. A label or selector change can silently detach a Service, a controller, or a network policy from the workload it governs, and the manifest diff looks like a one-line edit. That detachment is also how a workload loses the policy protection it was relying on, which the NetworkPolicy blast radius reviews guide covers from the enforcement side.

Capture the pre-apply state before an agent applies. A diff you cannot reproduce is a review you cannot defend, and audit evidence integrity checks covers the completeness question for any evidence you intend to keep.

Workflow from a proposed manifest through a field-ownership diff against live state, admission review, separate human approval, and a post-apply ownership verification.
Editorial workflow based on F010 and F012. Ownership review precedes the apply, and a post-apply check confirms the intended manager owns the intended fields.

Admission Interaction

Admission is the gate between a manifest and the cluster. A request passes through validating and mutating webhooks, and for pods, through Pod Security Admission. A rejection at that gate turns the remediation into a policy question, and treating the manifest as untrusted input is the same instinct the OWASP secure coding with AI guidance frames for agent-written infrastructure.

Official, F011: the Pod Security Standards profiles define what is allowed. Enforcement depends on the admission configuration, which means the same manifest can be accepted in one namespace and rejected in another.

For an agent workflow this has two consequences. First, a manifest that looks correct can be rejected at admission, so the apply result is not guaranteed by the manifest alone. Second, a mutating webhook can change the object the agent applied, so what the agent reviewed is not always what lands. Both mean the post-apply state is the real evidence, not the manifest.

Admission outcome What it proves What it does not prove
Accepted The object satisfies configured admission policy Runtime behavior or ownership correctness
Rejected The object violates a configured policy That the policy is complete or correctly configured
Mutated A webhook changed the object That the agent’s reviewed value is what runs

Read the third row as the subtle one. An agent that reviews its own manifest cannot see a mutating webhook’s transformation, so the ownership and field review has to happen against the live object after apply. The habit of verifying the observed state rather than trusting the proposal is the same one the verification-done proof guide applies to agent tasks generally.

Approval and Apply Separation

The agent prepares the manifest and the ownership analysis. A human approves. Those are different roles, and collapsing them removes the control.

Independent, OWASP: OWASP guidance on secure coding with AI calls for human review of CI/CD changes made by AI coding agents and treats agent output as untrusted input. A server-side apply to a shared production object is a CI/CD change in the sense that matters here.

Official: Claude Code security documentation describes permission modes, sandboxing and managed settings as safeguards. These govern what an agent session can do on the workstation. They do not assign a business approval for a cluster write, and they do not decide whether the agent should own a field a controller needs.

Scope matters as much as separation. An agent doing a namespaced task should not hold cluster-wide write access, which is the RBAC question the Kubernetes RBAC least privilege reviews guide covers. The permission to apply is a separate decision from the approval to apply. Packaging the change record for an auditor is covered by SOC 2 change evidence packets, and deciding how much review a change deserves is covered by risk-tiered infrastructure approvals.

Apply outcome to expect Ownership evidence to retain Follow-up action
Apply succeeded, no conflict Post-apply ownership diff Verify controller still reconciles
Apply succeeded, took a field Ownership diff showing new manager Confirm the takeover was intended
Apply conflicted Conflict message naming the owning manager Resolve with the owning team, do not force
Apply mutated by webhook Live object versus reviewed manifest Re-review the final state

Never resolve a conflict by forcing ownership without a named approval. A forced apply silently takes every contested field, which is the exact outcome the review exists to prevent.

Tradeoff between server-side apply's partial-field writes that enable precise agent changes and the field-ownership conflicts that require explicit review.
Editorial tradeoff diagram based on F010 and F012. Partial-field writes are precise; the trade is that ownership must be reviewed, because a clean resource diff hides conflicts.

Post-Apply Ownership Check

The apply is not the end of the review. Ownership is only provable against the live object afterward.

After an agent applies, re-read the object with managed fields visible and confirm three things. The agent’s manager owns exactly the fields it intended. No controller or webhook lost a field it still needs. The object state matches what was approved, including any mutation a webhook applied.

bash
  # after apply, confirm who owns what
kubectl get deployment api -o yaml --show-managed-fields > after.yaml
# compare against the pre-apply ownership capture

Capture ownership before the apply too. A before-and-after pair is the only way to see a field that changed hands, and it is the artifact that resolves a dispute later. When a bad apply reaches production, the path back is the same one break-glass incident access covers for time-boxed emergency credentials, and reconstructing what the agent did afterward draws on incident timeline request correlation.

Rollback and Conflict Handling

Rollback on a server-side apply is not a simple revert. Removing a field the agent owned does not automatically return it to the previous manager; the field may be left without an owner or require the previous manager to re-apply and take it back. Treating that rollback as a change in its own right, with its own approval, is the discipline change freeze emergency rules covers for exceptional changes during a freeze.

Plan the rollback before the apply. Know which manager will re-own each field the agent takes. If the agent’s change conflicts with a controller, resolve it by deciding who should own the field, not by forcing the apply and hoping the controller adapts.

Situation Safe response Unsafe response
Agent field conflicts with controller Decide ownership with the platform owner Force the apply
Agent change needs reverting Re-apply the prior value as the intended manager Delete the field and assume rollback
Ownership record is ambiguous Re-apply with explicit manager names Leave kubectl as shared identity
Post-apply state differs from review Investigate the webhook or controller Accept the diff as intended

Official, F011 reminder: admission configuration governs whether a rollback manifest is accepted, so a rollback can itself be rejected. Treat a rollback as a change that needs the same review as the original apply.

Control checklist covering explicit manager identity, field-ownership diff, shared-object review, admission interaction, apply and approval separation, and a post-apply ownership verification.
Editorial control checklist derived from F010 through F012. Passing the checklist shows ownership was reviewed honestly; it does not certify the resulting workload.

Working with Claude Code on a server-side apply

Give the agent four inputs: the target object and namespace, the fields it intends to change, the manager identity it must use, and the definition of a complete proposal. Ask for a field-ownership diff against the live object, not only a manifest summary, and ask it to name any field currently owned by a controller or webhook.

The agent can read the object and prepare the apply. Deciding whether it should take a controller’s field is a platform decision. Claude Code security documentation covers the safeguards that keep the agent scoped, and the OWASP AI cheat sheet frames why its output stays untrusted. For the permissions behind the apply, the Kubernetes RBAC least privilege reviews guide covers scoping the agent identity. For standing exceptions that allow an agent to apply at all, the security exception expiry and ownership guide covers how to keep those exceptions from becoming permanent, and the platform governance council charter guide covers who owns that decision at the organizational level.

Verdict that a reviewer must see which fields an agent would own on a shared object before any cluster write happens.
Editorial verdict based on F010 and F012. Review field ownership, not only the resource diff, and keep the apply decision with a human.

The concrete win, loss, and implication

The concrete win is visible ownership. With an explicit manager identity and a before-and-after field diff, a reviewer can say which system owns each field after the apply, which makes conflicts diagnosable instead of mysterious.

The concrete loss is that server-side apply moves complexity from the manifest to the ownership model. A change can be textually simple and still create a conflict that only appears against live state, and a rollback is more involved than deleting a field.

The practical implication is to scope the agent before it writes. Teams that give the agent its own manager identity, a namespace boundary, and a field-ownership review catch controller conflicts in review. Teams that let the agent apply as kubectl across shared objects discover ownership problems when a controller stops reconciling.

Field ownership is one of several cluster-write boundaries. Kubernetes RBAC least privilege reviews covers the additive permission union that decides what the agent can touch. NetworkPolicy blast radius reviews covers traffic policy whose enforcement depends on the CNI. Pod Security admission gate reviews covers the admission gate that decides whether a manifest is accepted.

The Terraform side of shared-state review is covered by Terraform plan review gates, Terraform state locking and access controls, and Terraform drift triage. Identity governance across cloud and cluster appears in cloud IAM permission boundaries and access recertification for agent identities. Change accountability is covered by RACI ownership for infrastructure changes and risk-tiered infrastructure approvals.

Data gap and future update

The server-side apply reference was identified as the canonical source for F010 and F012 but was not fetched in the research pass, so exact manager-identity and conflict wording should be verified against the live page before relying on a fine detail. The Pod Security Admission page was also not fetched; the profile definitions in F011 come from the fetched Pod Security Standards page.

No measurement of apply-conflict frequency, controller reconcile breakage, or rollback success is reported here, because none was collected. Behavior of a specific mutating webhook or controller is a property of that controller and is not generalized here. A future update documenting ownership outcomes for a specific controller would need cluster-level evidence.

One AI API Key option for OpenAI-format agents

Claude Code uses an Anthropic-format route, so the One AI free model IDs are not a Claude Code model source. The packet records Claude IDs as unavailable on 2026-11-27.

OpenAI-format agents have a separate route: One AI API Key provides https://api.oneaiapikey.com/v1, one key, and 46 live free IDs. That is a different client and request format, not a workaround for Claude Code authentication. Check the free model list for eligibility, read the quickstart for request shape, or compare hosted options with the cost calculator.

FAQ

What is a field manager and why does it matter?

A field manager is the identity server-side apply records as owning each field an apply sets. It matters because ownership decides whether a later apply conflicts. An agent writing as kubectl is indistinguishable from every human kubectl user, which makes ownership disputes impossible to resolve after the fact.

Does a clean manifest diff mean there are no conflicts?

No. Server-side conflicts are decided at apply time against live field ownership, so a clean client-side diff says nothing about whether the API server will report a conflict or whether the agent would take a controller’s field.

Why not just force the apply when a conflict appears?

A forced apply silently takes ownership of every contested field. That can stop a controller from reconciling a field it needs. Resolve the conflict by deciding who should own the field, with a named approval, rather than forcing it.

Does admission acceptance mean the change is safe?

No. Admission acceptance means the object satisfied the configured policy at that moment. A mutating webhook may have changed the object, and runtime behavior is a separate question. Treat admission as a gate, then verify the live object after apply.

Should the agent have cluster-wide write access for a namespaced task?

No. Scope the agent identity to the namespace and verbs it actually needs, which is the least-privilege question the RBAC reviews guide covers. Cluster-wide write for a namespaced task expands blast radius without a benefit.

More Claude Code troubleshooting

Sources

More in Blog

Try it

One API key for GPT, Grok, DeepSeek, Kimi, GLM, MiniMax, Qwen, Step, Beam, Nemotron, ERNIE, Hunyuan, Gemma, Laguna, LFM, LongCat, Llama, Solar, Jais, Mistral, K2 and Roleplay.

One AI API Key speaks the OpenAI and Anthropic formats, so you change the base URL and the key, not your code. Credit packs start at $10, and every model has a published per-token rate.

New accounts$10 credit on sign-up
Claim $10 credit →