Kcna Kubernetes And Cloud Native Associate · Free Practice Question Medium
Question 42
You have an application running on a Kubernetes cluster but want to manually scale out the number of pods. What is the process to scale the number of pods without impacting existing workloads in the deployment?
-
A
Create a new definition file that indicates the desired number of pods to add to the deployment. Apply the definition file using
kubectl update -f bryan.yaml deployment/app -
B
Modify the definition file and update the number of replicas to the desired number. Apply the new configuration using
kubectl apply -f bryan.yaml -
C
Run the command
kubectl deploy --scale=5 -
D
Add a load balancer server to the definition file and indicate the number of targets. Deploy the updated definition using the
kubectl update deployment/app
Reveal correct answer
Correct answer: B
Explanation
To manually scale the number of pods for an application running on a Kubernetes cluster without impacting existing workloads, you can use the kubectl command-line tool to update the desired replica count of the corresponding deployment, replica set, or stateful set.
https://jamesdefabia.github.io/docs/user-guide/kubectl/kubectl_apply/
A. Creating a new definition file to indicate the desired number of pods and applying it using 'kubectl update -f' is not the recommended way to manually scale out the number of pods in a Kubernetes deployment. Modifying the existing deployment's definition file is the standard practice for scaling deployments without impacting existing workloads.
B. Modifying the definition file of the deployment and updating the number of replicas to the desired number allows you to manually scale out the number of pods. By applying the new configuration using the 'kubectl apply -f' command, Kubernetes will make the necessary changes to the deployment without impacting existing workloads.
C. The command 'kubectl deploy --scale=5' is not the correct way to manually scale out the number of pods in a Kubernetes deployment. This command is not valid for scaling deployments and may result in errors.
D. Adding a load balancer server to the definition file and indicating the number of targets is not the correct process for manually scaling out the number of pods in a Kubernetes deployment. This process is related to setting up load balancing and does not directly impact the number of pods in the deployment.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
