Bird
0
0

How can you combine an HTTP liveness probe with a custom HTTP header "X-Health: true" in Kubernetes pod spec?

hard📝 Application Q9 of 15
Kubernetes - Health Checks and Probes
How can you combine an HTTP liveness probe with a custom HTTP header "X-Health: true" in Kubernetes pod spec?
AlivenessProbe: httpGet: path: /healthz port: 8080 headers: - X-Health: true initialDelaySeconds: 10 periodSeconds: 5
BlivenessProbe: httpGet: path: /healthz port: 8080 initialDelaySeconds: 10 periodSeconds: 5
ClivenessProbe: exec: command: ["curl", "-H", "X-Health:true", "/healthz"] initialDelaySeconds: 10 periodSeconds: 5
DlivenessProbe: httpGet: path: /healthz port: 8080 httpHeaders: - name: X-Health value: "true" initialDelaySeconds: 10 periodSeconds: 5
Step-by-Step Solution
Solution:
  1. Step 1: Understand httpHeaders syntax

    Custom HTTP headers are specified under httpHeaders as a list of name/value pairs.
  2. Step 2: Verify correct YAML structure

    livenessProbe: httpGet: path: /healthz port: 8080 httpHeaders: - name: X-Health value: "true" initialDelaySeconds: 10 periodSeconds: 5 correctly uses httpHeaders with name and value fields under httpGet.
  3. Final Answer:

    Correct HTTP liveness probe with custom header -> Option D
  4. Quick Check:

    Custom headers use httpHeaders list with name/value [OK]
Quick Trick: Use httpHeaders list with name and value for custom headers [OK]
Common Mistakes:
  • Using 'headers' instead of 'httpHeaders'
  • Trying to add headers in exec command incorrectly
  • Omitting httpHeaders when custom headers needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes