You created a Kubernetes deployment by running kubectl run nginx image=nginx replicas=1. After a few days, you decided you no longer want this deployment. You identified the pod and deleted it by running kubectl delete pod.
You noticed the pod got recreated.
✑ $ kubectl get pods
✑ NAME READY STATUS RESTARTS AGE
✑ nginx-84748895c4-nqqmt 1/1 Running 0 9m41s
✑ $ kubectl delete pod nginx-84748895c4-nqqmt
✑ pod nginx-84748895c4-nqqmt deleted
✑ $ kubectl get pods
✑ NAME READY STATUS RESTARTS AGE
✑ nginx-84748895c4-k6bzl 1/1 Running 0 25s
What should you do to delete the deployment and avoid pod getting recreated?
A . kubectl delete deployment nginx
B . kubectl delete Cdeployment=nginx
C . kubectl delete pod nginx-84748895c4-k6bzl Cno-restart 2
D . kubectl delete inginx
Answer: A
Explanation:
This command correctly deletes the deployment. Pods are managed by kubernetes workloads (deployments). When a pod is deleted, the deployment detects the pod is unavailable and brings up another pod to maintain the replica count. The only way to delete the workload is by deleting the deployment itself using the kubectl delete deployment command.
✑ $ kubectl delete deployment nginx
✑ deployment.apps nginx deleted
Ref: https://kubernetes.io/docs/reference/kubectl/cheatsheet/#deleting-resources
Latest Associate Cloud Engineer Dumps Valid Version with 181 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund