Interview Prep/Kubernetes/Deployments and rollouts

What is the difference between `kubectl apply` and `kubectl create`, and which do you use in pipelines?

BeginnerScenarioDeployments and rollouts
Answer

Situation read → A pipeline step failed with "AlreadyExists".

What I'd do →

  1. Use kubectl apply -f (declarative) in pipelines
  2. Use create only for imperative one-offs, which errors if the object exists
  3. Use kubectl diff before apply to preview
  4. Prefer server-side apply with --server-side for large objects such as CRDs

Why → apply stores the desired state and merges changes, so it is idempotent. create is a single imperative action.

Interview tip → Mention annotation size limits (262144 bytes) that break client-side apply on large CRDs.

All Kubernetes questions Roadmap: Kubernetes core

More on Deployments and rollouts