Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Declarative Resources

Direct answer

Declarative resources describe the desired Kubernetes objects in YAML and apply them with kubectl apply or GitOps, letting the cluster reconcile toward that state instead of running imperative commands.

When to use this

Use this when applying Kubernetes resources declaratively.

First 30 seconds

1. Declarative resources: apply desired state; Kubernetes reconciles.

2. Server-side apply tracks field ownership.

3. Avoid imperative kubectl edit in production.

4. Prune carefully.

5. GitOps for drift correction.

Operational verification

desired manifests → apply → controllers reconcile

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Kubernetes declarative automation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformKubernetes declarative automation · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior.
Scope / prerequisiteUse this when applying Kubernetes resources declaratively.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification path Verify boundary

The negative fixture should deliberately exercise risks such as schema drift, selector overreach, admission rejection, controller lag, immutable fields, stale status and confusing created object with ready workload, choosing the cases most relevant to desired object declarations, server-side validation/defaulting, generation/resourceVersion and controller reconciliation rather than imperative command history.

Step 2 Common mistakes Narrow the fault
  • Mixing kubectl edit with declarative apply.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Apply manifests with kubectl apply or GitOps.
  • Server-side dry run validates against the cluster.
  • kubectl diff shows changes.
Key checks
  • kubectl apply --server-side -f manifests/ — server-side apply
  • kubectl diff -f manifests/ — preview
  • Field managers — ownership
ReferenceWhy it matters1 section · depth on demand

In depth

Kubernetes is declarative: you describe the desired state of resources, and controllers continuously work to make the cluster match it. You do not tell Kubernetes to start a container; you declare that a Deployment should have three replicas, and the controller creates, replaces or removes pods until that is true.

Consequences for automation:

  • kubectl apply is idempotent — applying the same manifest twice changes nothing.
  • Manual changes are overwritten when manifests are re-applied or reconciled by GitOps.
  • Status (.status) reports what the controller has achieved; the spec is what you asked for.
kubectl get deploy netbox-sync -o jsonpath='{.spec.replicas} {.status.readyReplicas}'
kubectl rollout status deploy/netbox-sync --timeout=120s
ReferenceImportant terms & boundaries1 section · depth on demand
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docKubernetes declarative automation current

Authoritative/upstream documentation reviewed for bounded claims in Kubernetes Automation > Declarative Resources. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/ · confidence 94%
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Output interpretation

For desired object declarations, server-side validation/defaulting, generation/resourceVersion and controller reconciliation rather than imperative command history, prefer typed fields and stable IDs over human presentation text.

Confirmation

Confirm action

Continue?