Challenge - 5 Problems
Pod Command Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
Output of command executed inside a Pod
You run the command
kubectl exec mypod -- ls /app on a Pod named mypod. The Pod's /app directory contains files index.html and config.yaml. What will be the output?Attempts:
2 left
💡 Hint
The
kubectl exec command runs the given command inside the Pod's container.✗ Incorrect
The
ls /app command lists files inside the /app directory of the Pod. Since the directory contains index.html and config.yaml, these are listed.🧠 Conceptual
intermediate1:30remaining
Understanding kubectl exec command syntax
Which of the following is the correct syntax to execute the command
cat /etc/hosts inside a Pod named webserver?Attempts:
2 left
💡 Hint
The Pod name comes immediately after
kubectl exec, followed by -- to separate the command.✗ Incorrect
The correct syntax is
kubectl exec POD_NAME -- COMMAND. Option B follows this format exactly.❓ Troubleshoot
advanced2:00remaining
Troubleshooting kubectl exec permission error
You try to run
kubectl exec mypod -- whoami but get the error: error: unable to upgrade connection: Forbidden. What is the most likely cause?Attempts:
2 left
💡 Hint
The error mentions 'Forbidden', which relates to permissions.
✗ Incorrect
The 'Forbidden' error means the user does not have RBAC permissions to exec into the Pod. The Pod existing or command presence would cause different errors.
🔀 Workflow
advanced2:00remaining
Executing an interactive shell inside a Pod
You want to open an interactive bash shell inside a Pod named
backend. Which command should you use?Attempts:
2 left
💡 Hint
Use flags
-i and -t for interactive terminal.✗ Incorrect
The correct command uses
-it flags before the Pod name and -- to separate the command. Option A is correct.✅ Best Practice
expert2:30remaining
Best practice for running commands in multi-container Pods
A Pod has two containers:
app and sidecar. You want to run ls /data inside the sidecar container. Which command is correct?Attempts:
2 left
💡 Hint
Use
-c or --container with kubectl exec to specify container.✗ Incorrect
The correct syntax is
kubectl exec POD -c CONTAINER -- COMMAND. Option C uses the short flag -c correctly. Options B and C have wrong flag usage or missing --. Option C misses -- separator.