Certified Kubernetes Application Developer (CKAD) Practice Test 2026 - Free CKAD Practice Questions and Comprehensive Study Guide

Question: 1 / 400

How do you access a running pod's shell using kubectl?

kubectl connect [pod-name]

kubectl exec -it [pod-name] -- /bin/sh

Accessing a running pod's shell using the command line interface provided by Kubernetes can be achieved through the use of the exec command with specific flags to enable interactive mode.

Using the command provided in the correct answer initiates a new process within the running container of the specified pod. The `-it` flags are crucial because `-i` stands for interactive, allowing you to interact with the shell session, and `-t` allocates a pseudo-TTY, which provides a terminal interface. The `-- /bin/sh` part of the command specifies the shell to start within the container. This is particularly useful when the container doesn't have a full-fledged shell like bash, and `/bin/sh` is often available in many containers.

This method is straightforward and widely used for troubleshooting and executing commands within a pod, enabling you to check configurations, run diagnostics, and perform other administrative actions directly within the pod's environment.

While other options are related to interacting with pods, they do not achieve the same result of accessing a shell environment. For instance, connecting, attaching, or using a non-existent shell command does not facilitate a direct shell access scenario as effectively as exec does.

Get further explanation with Examzify DeepDiveBeta

kubectl shell [pod-name]

kubectl attach [pod-name]

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy