Question 410
At Northstar finance, in an isolated training cluster during a scheduled maintenance rehearsal: The Deployment invoice-api in namespace ledger must target nodes labeled workload=restricted in a disposable lab. Work only within the stated target and verify before declaring success. Which Kubernetes behavior best explains the required change or diagnosis?
Explanation
Correct Answer
Node selectors constrain scheduling to nodes whose labels match all specified key/value pairs; patching the Pod template triggers a rollout. This explains the stated condition. The corresponding action is: Run kubectl -n ledger patch deployment invoice-api --type=merge -p '{"spec":{"template":{"spec":{"nodeSelector":{"workload":"restricted"}}}}}'. The direct acceptance evidence is: Run kubectl -n ledger get deployment invoice-api -o jsonpath='{.spec.template.spec.nodeSelector}' and check Pod placements.
Incorrect Answers
This principle describes a separate cause: Scaling the Deployment changes desired replica count through its controller; editing an individual Pod would not preserve the desired state. The reported condition is governed by: Node selectors constrain scheduling to nodes whose labels match all specified key/value pairs; patching the Pod template triggers a rollout. The two mechanisms should not be conflated.
Deployment rolling-update parameters govern how many old Pods may be unavailable and extra Pods may be created during replacement. That explanation applies to a different technical failure. Here the controlling principle is: Node selectors constrain scheduling to nodes whose labels match all specified key/value pairs; patching the Pod template triggers a rollout.
The offered statement is true for this other mechanism: A toleration allows a Pod past a matching taint but does not ensure placement without node selection and capacity. It does not explain the facts described here, which follow from: Node selectors constrain scheduling to nodes whose labels match all specified key/value pairs; patching the Pod template triggers a rollout.