Certified Kubernetes Application Developer (CKAD) Practice Test

Disable ads (and more) with a premium pass for a one time $4.99 payment

Question: 1 / 165

How can you list all pods in a specific namespace using kubectl?

kubectl pods -n [namespace]

kubectl get all -n [namespace]

kubectl show pods -n [namespace]

kubectl get pods -n [namespace]

The command `kubectl get pods -n [namespace]` is the correct way to list all pods in a specific namespace. The `get` command is designed to retrieve resources in Kubernetes, and when specifying `pods`, it directs the command to list only pod resources. The `-n [namespace]` flag indicates the target namespace, which is essential because Kubernetes can contain multiple namespaces, each potentially hosting different resources.

This command would yield a list of all pods operating within the specified namespace, providing their status and other relevant details crucial for monitoring and managing applications.

While other commands presented may seem similar, they either do not correctly specify the resource type or utilize an incorrect syntax. For instance, simply using `kubectl pods` without 'get' is not a valid command, while `kubectl get all -n [namespace]` would show all types of resources (not just pods) in the specified namespace. Similarly, `kubectl show pods -n [namespace]` is not a recognized command in Kubernetes. Focusing on `kubectl get pods` with the namespace specification is the correct and most effective approach for listing pods specifically.

Get further explanation with Examzify DeepDiveBeta
Next

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy