Kubernetes and Cloud Native Associate (KCNA) — Question 70

Which of the following is the correct command to run a nginx deployment with 2 replicas?

Answer options

Correct answer: B

Explanation

The correct answer is B because the 'kubectl create deploy' command is the correct way to create a deployment in Kubernetes, and it supports specifying the number of replicas with the '--replicas' flag. Option A is incorrect as 'kubectl run' does not support creating deployments with replicas directly. Options C and D are incorrect due to incorrect command syntax or flags.