A deployment 'api-deploy' has resource limits set but is frequently being OOMKilled. The team suspects the memory limit is too low. Which approach should be taken to confirm this without causing downtime?
Trap 1: Create a new pod with a higher memory limit and delete the old pods…
Manually creating a separate pod and deleting Deployment pods fights the controller: the Deployment's ReplicaSet immediately recreates deleted pods to match its current template, so the manual replacement is cosmetic and short-lived. A standalone pod is outside the Deployment's management, meaning it receives no rolling updates, self-healing, or replica reconciliation. This approach causes unnecessary downtime and does not persist the increased memory limit in the desired state.
Trap 2: Set the memory limit to unlimited by removing the limit section and…
Removing the memory limit entirely removes the safety boundary that prevents a single container from exhausting node memory; the kubelet or OOM killer may then terminate the container or evict neighboring pods when the workload spikes. Restarting the pod manually only applies to that ephemeral instance—the Deployment controller will enforce the original spec on the next reconciliation, so the change is lost. Unbounded pods are a cluster-risk anti-pattern, not a fix for memory pressure.
Trap 3: Use 'kubectl set resources' to increase the limit on the running…
'kubectl set resources' is a subcommand for mutating workload controllers such as Deployments, StatefulSets, or ReplicaSets—it cannot mutate an individual Pod because a Pod's resource requests and limits are immutable after creation. Running it against a Pod either fails or changes the controller's template, which then triggers a rollout of new pods, not a dynamic in-place adjustment. The running pod keeps its old limit until it is terminated and replaced, so the phrase 'increase the limit on the running pod dynamically' is technically false.
- A
Create a new pod with a higher memory limit and delete the old pods manually.
Why wrong: Manually creating a separate pod and deleting Deployment pods fights the controller: the Deployment's ReplicaSet immediately recreates deleted pods to match its current template, so the manual replacement is cosmetic and short-lived. A standalone pod is outside the Deployment's management, meaning it receives no rolling updates, self-healing, or replica reconciliation. This approach causes unnecessary downtime and does not persist the increased memory limit in the desired state.
- B
Set the memory limit to unlimited by removing the limit section and restart the pod.
Why wrong: Removing the memory limit entirely removes the safety boundary that prevents a single container from exhausting node memory; the kubelet or OOM killer may then terminate the container or evict neighboring pods when the workload spikes. Restarting the pod manually only applies to that ephemeral instance—the Deployment controller will enforce the original spec on the next reconciliation, so the change is lost. Unbounded pods are a cluster-risk anti-pattern, not a fix for memory pressure.
- C
Use 'kubectl set resources' to increase the limit on the running pod dynamically.
Why wrong: 'kubectl set resources' is a subcommand for mutating workload controllers such as Deployments, StatefulSets, or ReplicaSets—it cannot mutate an individual Pod because a Pod's resource requests and limits are immutable after creation. Running it against a Pod either fails or changes the controller's template, which then triggers a rollout of new pods, not a dynamic in-place adjustment. The running pod keeps its old limit until it is terminated and replaced, so the phrase 'increase the limit on the running pod dynamically' is technically false.
- D
Increase the memory limit in the deployment spec and apply the change; the rollout will automatically restart pods.
Editing the Deployment's pod template and applying the manifest updates the desired state, which makes the Deployment controller create a new ReplicaSet while scaling down the old one according to the configured strategy (default RollingUpdate). New pods are launched with the increased memory limit, and old pods are terminated only once the new ones are Healthy, keeping the service available throughout. Because the Pod spec is immutable, the template change is the declarative, supported path to alter resources without manual pod handling.