KCNA · Question #118
Which command lists the running containers in the current Kubernetes namespace?
The correct answer is A. kubectl get pods. The kubectl get pods command lists all pods in the current Kubernetes namespace, showing their status, including those with running containers.
Question
Which command lists the running containers in the current Kubernetes namespace?
Options
- Akubectl get pods
- Bkubectl ls
- Ckubectl ps
- Dkubectl show pods
How the community answered
(19 responses)- A95% (18)
- D5% (1)
Why each option
The `kubectl get pods` command lists all pods in the current Kubernetes namespace, showing their status, including those with running containers.
In Kubernetes, containers run inside Pods, and `kubectl get pods` is the standard and most direct command to list all Pods in the current namespace, along with their current status like 'Running', 'Pending', or 'Completed'.
`kubectl ls` is not a standard Kubernetes command for listing resources.
`kubectl ps` is not a standard Kubernetes command; while `docker ps` lists running containers in Docker, Kubernetes uses `kubectl get pods`.
`kubectl show pods` is not a standard Kubernetes command for listing pods; the correct verb is `get`.
Concept tested: Kubernetes Pod listing command
Source: https://kubernetes.io/docs/reference/kubectl/cheatsheet/#viewing-finding-resources
Topics
Community Discussion
No community discussion yet for this question.