Bird
0
0

Which of the following is a correct way to define a liveness probe using an HTTP GET request in a pod spec?

easy📝 Configuration Q12 of 15
Kubernetes - Health Checks and Probes
Which of the following is a correct way to define a liveness probe using an HTTP GET request in a pod spec?
A"livenessProbe:\n httpGet:\n path: /healthz\n port: 8080\n initialDelaySeconds: 5"
B"livenessProbe:\n exec:\n command: [\"curl\", \"/healthz\"]\n initialDelaySeconds: 5"
C"livenessProbe:\n tcpSocket:\n path: /healthz\n port: 8080\n initialDelaySeconds: 5"
D"livenessProbe:\n httpGet:\n path: healthz\n port: 'eighty'\n initialDelaySeconds: 5"
Step-by-Step Solution
Solution:
  1. Step 1: Check HTTP GET syntax for livenessProbe

    The correct syntax uses httpGet with path and numeric port. "livenessProbe:\n httpGet:\n path: /healthz\n port: 8080\n initialDelaySeconds: 5" matches this.
  2. Step 2: Identify errors in other options

    "livenessProbe:\n exec:\n command: [\"curl\", \"/healthz\"]\n initialDelaySeconds: 5" uses exec with curl incorrectly. "livenessProbe:\n tcpSocket:\n path: /healthz\n port: 8080\n initialDelaySeconds: 5" wrongly uses tcpSocket with a path. "livenessProbe:\n httpGet:\n path: healthz\n port: 'eighty'\n initialDelaySeconds: 5" uses a string for port instead of a number.
  3. Final Answer:

    "livenessProbe:\n httpGet:\n path: /healthz\n port: 8080\n initialDelaySeconds: 5" -> Option A
  4. Quick Check:

    HTTP GET probe syntax = "livenessProbe:\n httpGet:\n path: /healthz\n port: 8080\n initialDelaySeconds: 5" [OK]
Quick Trick: HTTP GET needs numeric port and valid path [OK]
Common Mistakes:
  • Using string instead of number for port
  • Adding path to tcpSocket probe
  • Using exec command incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes