Pcornel
Automation · Kubernetes Automation

Declarative Resources

Cheat sheet · https://pcornel.dk/topic.php?topic=5794

Back to the Topic

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.

Remember

  • Apply manifests with kubectl apply or GitOps.
  • Server-side dry run validates against the cluster.
  • kubectl diff shows changes.

First checks

  • kubectl apply --server-side -f manifests/ — server-side apply
  • kubectl diff -f manifests/ — preview
  • Field managers — ownership

Commands

kubectl apply
kubectl edit

Verify in this order

desired manifests → apply → controllers reconcile

Where it usually breaks

Configuration/input → graph/state refresh → plan → provider API request → provider terminal result → resource read-back → effective service state → workload.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5794

Confirmation

Confirm action

Continue?