﻿# Job replacement Pods: parallelism does not bound terminating workers

Explain overlap between terminating and replacement Job Pods, then verify replacement policy, process exit and external work ownership separately.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/kubernetes-job-pod-replacement-race/
Language: en

A batch worker receives a termination request while its replacement starts downloading the same model. An operator expected parallelism to cap the combined population. The missing distinction is between desired active work, Pods that are terminating and processes that have actually stopped.

## Identify overlapping attempts

Start with Job UID, Pod UID, completion index and deletion timestamp. Names alone cannot distinguish attempts reliably. Attach process-level start and exit evidence when available. In an Indexed Job, overlapping attempts can represent the same logical input; the [shard identity guide](/journal/guide-ks-job-indexed/) explains why outputs need stable input identity. This investigation instead asks when the controller may create another attempt and what still consumes resources during shutdown.

## Read the replacement trigger

The [Job documentation](https://kubernetes.io/docs/concepts/workloads/controllers/job/) describes TerminatingOrFailed as allowing replacement when deletion becomes apparent. Terminating Pods can therefore overlap replacements, exceeding parallelism in the combined population or creating overlapping attempts for an index. Failed delays replacement until the earlier Pod reaches its terminal phase. Inspect the effective podReplacementPolicy rather than guessing from its omission. Jobs with podFailurePolicy use Failed; their documented permitted configuration differs from Jobs without that policy.

## Separate API state from process life

The [Pod lifecycle reference](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/) describes graceful termination, forced deletion and the limits of proving that processes have stopped. A deletion timestamp starts a lifecycle transition; it is not a stop receipt. Force removal from the API can leave processes running. The separate [finalizer investigation](/journal/kubernetes-finalizer-stuck-deletion/) concerns cleanup ownership and should not be used as justification for deleting metadata to accelerate replacement.

## Choose the intended tradeoff

If startup temporarily doubles model downloads or memory demand, delayed replacement may avoid the documented overlap while increasing recovery time. State which resources matter: container memory, node storage, external leases and application sessions can have different lifetimes. A controller policy does not revoke a worker's credentials at an external service. For partitioned or unresponsive nodes, design explicit external work ownership instead of treating terminal Pod status as a universal fencing mechanism.

## Observe shutdown and replacement together

In a disposable run, let a worker report that shutdown has started and delay its actual exit within the allowed grace period. Compare permitted replacement policies with identical work and record status.terminating, Pod phases, replacement creation and resource observations. Preserve application publication attempts too. Acceptance is a trace explaining the configured trigger and observed overlap, not merely a final count of successful Pods. No timing or resource savings are asserted without that trace.

## Retain the recovery boundary

Keep normal graceful termination separate from node isolation and forced API deletion. A test of cooperative shutdown does not establish behavior when a kubelet cannot be reached. Record the controller and feature configuration used, since observed conditions belong to that deployment. Failed can be a useful scheduling choice, but it does not make output publication exactly once, erase unfinished writes, or demonstrate that every remote effect stopped at the moment Kubernetes recorded a terminal phase.
