0
0
Kubernetesdevops~20 mins

Exec probe configuration in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Exec Probe Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the result of this exec probe configuration?
Given the following Kubernetes pod YAML snippet, what will be the status of the exec probe if the command exits with code 1?
Kubernetes
livenessProbe:
  exec:
    command:
    - /bin/sh
    - -c
    - exit 1
  initialDelaySeconds: 5
  periodSeconds: 10
AThe probe succeeds and the container continues running.
BThe probe fails and the container is restarted.
CThe probe is ignored because exit code 1 is treated as success.
DThe pod enters CrashLoopBackOff immediately.
Attempts:
2 left
💡 Hint
Exec probes consider exit code 0 as success; any other code means failure.
Configuration
intermediate
2:00remaining
Identify the correct exec probe configuration to check a file exists
Which exec probe configuration correctly checks if the file /tmp/healthy exists inside the container?
A
exec:
  command:
  - test
  - -f
  - /tmp/healthy
B
exec:
  command:
  - ls
  - /tmp/healthy
C
exec:
  command:
  - echo
  - /tmp/healthy
D
exec:
  command:
  - cat
  - /tmp/healthy
Attempts:
2 left
💡 Hint
Use a command that returns exit code 0 if the file exists.
Troubleshoot
advanced
2:00remaining
Why does this exec probe always fail?
A pod has this exec probe: livenessProbe: exec: command: - /bin/false initialDelaySeconds: 5 periodSeconds: 10 Why does the container keep restarting?
ABecause the exec probe command is missing arguments.
BBecause the initialDelaySeconds is too short for the container to start.
CBecause /bin/false always exits with code 1, causing probe failure.
DBecause the probe type should be HTTP, not exec.
Attempts:
2 left
💡 Hint
Check the exit code behavior of /bin/false.
🔀 Workflow
advanced
2:00remaining
Order the steps to add an exec readiness probe to a deployment
Put these steps in the correct order to add an exec readiness probe that checks if a service is ready:
A2,1,3,4
B3,1,2,4
C1,3,2,4
D1,2,3,4
Attempts:
2 left
💡 Hint
You must edit before applying, and verify last.
Best Practice
expert
2:00remaining
Which exec probe command is best for checking a web server health inside a container?
You want an exec probe to check if a web server inside the container is healthy by verifying port 8080 is open. Which command is best?
A
exec:
  command:
  - nc
  - -z
  - localhost
  - "8080"
B
exec:
  command:
  - curl
  - -I
  - http://localhost:8080/health
C
exec:
  command:
  - telnet
  - localhost
  - 8080
D
exec:
  command:
  - ping
  - localhost
Attempts:
2 left
💡 Hint
Use a command that checks if a port is open without requiring HTTP response.