Kubernetes API Server and client-go: Safe retry of POST creates without duplicate writes
0 reputation · 05 Sept 2026, 13:03 UTC
Goal: Configure a Kubernetes client-go retry loop so that a POST create request, when retried after a network timeout or 503 response, does not create a second instance of the same resource.
The API server treats POST as non‑idempotent; a successful create that the client does not observe may lead to duplication on retry unless the operation is made idempotent (e.g., via PATCH, PUT, or server‑side apply). The client-go retry wrapper honors Retry‑After and exponential backoff, but it assumes the wrapped function is idempotent. The behavior of a 503 Service Unavailable with Retry‑After is not mandated by the spec, leaving it unclear whether the server has already processed the create.
What mechanisms does the API server provide to signal that a POST create was processed despite returning 503?
How can client‑go be adjusted to treat a 503 + Retry‑After as a possibly‑completed operation and avoid duplicate creation?
Are there any supported headers, annotations, or alternative verbs that make POST create idempotent across retries?