
Answer-first summary for fast verification
Answer: `kubectl delete deployment nginx`
The correct answer is `kubectl delete deployment nginx`. This command effectively removes the deployment, which in turn stops the recreation of the pod. Other options are incorrect for various reasons: `kubectl delete nginx` lacks specificity on what to delete, `kubectl delete --deployment=nginx` uses an invalid parameter, and `kubectl delete pod nginx-84748895c4-k6bzl --no-restart` includes an unsupported flag. For more details, refer to the Kubernetes documentation on deleting resources.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You initially created a Kubernetes deployment with the command kubectl run nginx –image=nginx –replicas=1. After deciding to remove this deployment, you deleted the pod using kubectl delete pod, only to find it was recreated. What is the correct action to permanently delete the deployment and prevent the pod from being recreated?
A
kubectl delete nginx
B
kubectl delete --deployment=nginx
C
kubectl delete pod nginx-84748895c4-k6bzl --no-restart
D
kubectl delete deployment nginx
No comments yet.