NCP-AIO practice question 4 of 15

A system administrator needs to scale a Kubernetes Job to 4 replicas. What command should be used?

Full set: 66 questions
Answer options
A: kubectl stretch job --replicas=4
B: kubectl autoscale deployment job --min=1 --max=10
C: kubectl scale job --replicas=4 Correct answer
D: kubectl scale job -r 4
Correct Answer:
C. kubectl scale job --replicas=4
Explanation

The kubectl scale command is the standard method for manually adjusting the number of running pods for a scalable Kubernetes resource. When applied to a Job resource, this command modifies the .spec.parallelism field, which dictates how many pods can run concurrently. The syntax kubectl scale job --replicas=4 sets the desired parallelism to 4. Although the question omits the specific job name, option C correctly identifies the command, resource type, and flag required to achieve the administrator's goal.

Why Incorrect

A. kubectl stretch job --replicas=4 stretch is not a valid kubectl command. The correct command for changing the number of replicas is scale.
B. kubectl autoscale deployment job --min=1 --max=10 This command configures a HorizontalPodAutoscaler (HPA) for a Deployment, not a Job. It is used for automatic scaling, not manual scaling to a fixed number.
D. kubectl scale job -r 4 The shorthand flag -r is not a valid alias for --replicas in the kubectl scale command. The full flag name must be used.

References

1. Kubernetes Official Documentation, kubectl scale command: This document provides the official syntax and examples for the scale command. It lists job as a valid resource type that can be scaled and specifies the --replicas flag.

Reference: Kubernetes Documentation > Reference > Kubectl > kubectl scale. (kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#scale)

2. Kubernetes Official Documentation, Jobs: This page explains the concept of a Kubernetes Job, including the .spec.parallelism field, which is what kubectl scale modifies for this resource type.

Reference: Kubernetes Documentation > Concepts > Workloads > Workload Resources > Job > "Parallel Jobs". (kubernetes.io/docs/concepts/workloads/controllers/job/#parallel-jobs)

Scroll to Top