kubectl: atomic upsert

· Thiago Perrotta · June 9, 2026, 2:34 p.m.
Summary
This blog post discusses an atomic upsert method using kubectl to manage image-pull secrets in Kubernetes clusters, avoiding temporary gaps that can cause deployment failures. It proposes a solution using `kubectl create` with a client-side dry-run, followed by `kubectl apply`, ensuring the secret is continuously present without the risk of deletion. The author shares insights from personal experience, particularly around the behavior of the Kubernetes API and how it handles secrets, supported by practical examples.
AUTHOR
Sponsored
Zulip logo Zulip
Organized team chat for people who take work seriously. Topic-based threading keeps conversations focused.
Try Zulip
Become a sponsor →