Kcna Kubernetes And Cloud Native Associate · Free Practice Question Medium
Question 24
In your Kubernetes cluster, you have a pod (web) that runs two containers: an app and a sidecar container. How can you get detailed information about the pod to view the container names?
-
A
kubectl get pod web --describe -
B
kubectl describe pod web -
C
kubectl -f get web -
D
kubectl pod info web
Reveal correct answer
Correct answer: B
Explanation
To get detailed information about a pod, including its container names, you can use the kubectl describe command. Here's how you can do it: kubectl describe pod <pod-name>
Replace <pod-name> with the actual name of your pod (in this case, "web").
Running this command will provide you with extensive information about the specified pod, including details about each container within the pod. Look for the "Containers" section in the output, which will list the container names, their image details, and other relevant information. The container names will be clearly visible under this section, allowing you to identify the app and sidecar containers.
https://jamesdefabia.github.io/docs/user-guide/kubectl/kubectl_describe/
A. The command "kubectl get pod web --describe" is not the correct way to get detailed information about a specific pod in a Kubernetes cluster. The "--describe" flag is not used with the "kubectl get pod" command. The correct way to get detailed information about a pod is to use the "kubectl describe pod [pod_name]" command.
B. The command "kubectl describe pod web" is the correct way to get detailed information about a specific pod in a Kubernetes cluster. This command provides a detailed description of the pod, including information about the containers running within it, such as their names, statuses, and configurations.
C. The command "kubectl -f get web" is not the correct way to get detailed information about a specific pod in a Kubernetes cluster. The "-f" flag is used for specifying a file, not for retrieving information about pods. This command will not provide the detailed container names within the pod.
D. The command "kubectl pod info web" is not a valid command in Kubernetes for retrieving detailed information about a specific pod. The correct syntax for retrieving pod information is "kubectl describe pod [pod_name]". This command will not provide the detailed container names within the pod.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
