A service can pass every single-replica test and still accept the same signed request twice after it scales.
Imagine a request with nonce N reaches replica A. A verifies the signature and records N in its own memory. The same request is replayed to replica B. B has never seen N, so it accepts the request again.
Kubernetes can keep both replicas healthy and route traffic between them. It does not automatically synchronize application replay state.
The invariant
After a nonce is accepted, subsequent uses within the replay window must be rejected regardless of which replica receives them.
A shared store can help, but a shared database alone is not enough. A separate check and insert can race: two replicas both see no record and both accept. The acceptance decision needs an atomic operation, such as a uniqueness constraint or compare-and-set.
The key also needs the right scope. Depending on the protocol, that may include a tenant or source. And the record needs to survive for the entire replay window, including clock skew and membership changes.
Sticky routing isn't a guarantee
Affinity can make requests more likely to reach the same replica. But replicas restart, endpoints change and pools scale. If a nonce becomes fresh when ownership moves, the security property depends on a topology that is not stable.
Test beyond availability
Try accepting a nonce on A, replaying it to B, replacing A, and replaying it again. Then repeat while scaling the pool and while the replay store is unavailable. For security-sensitive ingress, a retryable refusal can be safer than accepting without a replay check.
The same reasoning applies to acknowledgement: returning success after putting an event only in process memory can lose it if the process crashes. Be explicit about the durability boundary your acknowledgement promises.
Replay prevention, idempotency and fencing protect different boundaries; none alone implies exactly-once delivery.
Originally published in Beyond Kubernetes Defaults on the Zen Mesh blog.
What failure tests have caught state-sharing assumptions in your systems?