Certified Kubernetes Application Developer (CKAD) Practice Test

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for the Certified Kubernetes Application Developer (CKAD) Exam. Gain confidence with flashcards and multiple-choice questions, complete with hints and explanations. Achieve your certification with ease!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which command is used to find the user of a pod/container?

  1. kubectl get user

  2. kubectl logs <pod>

  3. kubectl exec <pod> -it -- whoami

  4. kubectl describe pod <pod>

The correct answer is: kubectl exec <pod> -it -- whoami

The command "kubectl exec <pod> -it -- whoami" is used to find the user of a pod/container because it directly executes the `whoami` command within the specified pod's container. This utility command provides the username of the current user in the context of the running container, which is essential for understanding the permissions under which the processes inside that container are running. The `exec` command allows you to run arbitrary commands in a running container, and using the `-it` flags ensures that you get an interactive terminal, which is necessary when executing commands that require stdin, like `whoami`. By executing this, you receive immediate feedback on the user identity, which is critical for debugging and security purposes. Other commands listed would not return the user information: - Retrieving user information is not within the scope of `kubectl get user`, as this command does not exist in the Kubernetes CLI. - `kubectl logs <pod>` would only show the logs of the specified pod and does not provide information about users. - `kubectl describe pod <pod>` gives detailed information about the pod's configuration and status but would not directly indicate which user the container is running as. Thus, utilizing `kubectl