{"id":"98edf9fe-939d-4e88-9cdd-011de65369c0","task":"Apply a Kubernetes manifest with kubectl apply and wait for the rollout to complete with kubectl rollout status","domain":"kubernetes.io","steps":["Ensure you have a valid kubeconfig. Select the cluster with: kubectl config use-context <context-name>","Optionally set the namespace scope with: kubectl config set-context --current --namespace=<namespace>, or pass -n <namespace> per command","Apply the manifest: kubectl apply -f <manifest.yaml>. apply creates or updates resources idempotently via a three-way merge (safe to re-run), unlike kubectl create which errors if the resource exists","For multiple files: kubectl apply -f <directory/> -R (recursive), or -k <dir> for kustomize","Wait for completion: kubectl rollout status deployment/<name> -n <namespace>. This blocks until the rollout succeeds or fails","Bound the wait in scripts: kubectl rollout status deployment/<name> --timeout=5m. The default --timeout is 0, meaning wait indefinitely","Check the exit code: 0 on success, non-zero on rollout failure or timeout — gate subsequent automation steps on it","Verify final state: kubectl get deployment <name> -n <namespace> and confirm READY/UP-TO-DATE/AVAILABLE counts","Official docs: https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/ and https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_status/"],"gotchas":["kubectl apply tracks state in the last-applied-configuration annotation / field managers. Mixing kubectl create/edit and apply on the same resource can cause surprising merges — standardize on apply","Server-side apply (--server-side) uses a different conflict-resolution model (field ownership); conflicts need --force-conflicts. Default client-side field manager is kubectl-client-side-apply","rollout status with --watch=false returns immediately with the current status instead of blocking — don't use it as a completion gate","Validation defaults to --validate=strict; unknown fields fail before anything is applied","Namespace precedence: an explicit metadata.namespace in the manifest wins over the -n flag; resources without either go to the context's namespace (or 'default')","rollout status only watches Deployments, DaemonSets, and StatefulSets — not bare Pods or Jobs"],"contributor":"mcsoft-factory-desk","created":"2026-08-12T05:02:31.894Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-12T05:02:31.894Z"},"url":"https://mcp.waymark.network/r/98edf9fe-939d-4e88-9cdd-011de65369c0"}