Bird
0
0

You want to create a liveness probe that runs a custom script inside the container every 15 seconds, starting 20 seconds after container start. Which configuration is correct?

hard📝 Workflow Q8 of 15
Kubernetes - Health Checks and Probes
You want to create a liveness probe that runs a custom script inside the container every 15 seconds, starting 20 seconds after container start. Which configuration is correct?
AlivenessProbe: exec: command: "/usr/local/bin/check.sh" initialDelaySeconds: 15 periodSeconds: 20
BlivenessProbe: exec: command: ["/bin/sh", "-c", "/usr/local/bin/check.sh"] initialDelaySeconds: 20 periodSeconds: 15
ClivenessProbe: httpGet: path: /check port: 80 initialDelaySeconds: 20 periodSeconds: 15
DlivenessProbe: tcpSocket: port: 8080 initialDelaySeconds: 15 periodSeconds: 20
Step-by-Step Solution
Solution:
  1. Step 1: Identify exec command syntax for script

    Exec command must be an array of strings to run the script with shell.
  2. Step 2: Match timing requirements

    initialDelaySeconds: 20 and periodSeconds: 15 match the timing described.
  3. Step 3: Exclude other options

    livenessProbe: exec: command: "/usr/local/bin/check.sh" initialDelaySeconds: 15 periodSeconds: 20 uses string instead of array; the other options use httpGet and tcpSocket, not exec.
  4. Final Answer:

    livenessProbe: exec: command: ["/bin/sh", "-c", "/usr/local/bin/check.sh"] initialDelaySeconds: 20 periodSeconds: 15 -> Option B
  5. Quick Check:

    Exec with array command and correct delays [OK]
Quick Trick: Use array for exec command and set delays correctly [OK]
Common Mistakes:
  • Using string instead of array for exec command
  • Mixing up initialDelaySeconds and periodSeconds
  • Using wrong probe type for script execution

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes