0
0
Kubernetesdevops~20 mins

Liveness probe concept in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Liveness Probe Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the main purpose of a liveness probe in Kubernetes?

Choose the best description of what a liveness probe does in a Kubernetes pod.

AIt controls the network traffic routing to the pod.
BIt monitors the CPU usage of the pod and scales it up if usage is high.
CIt checks if the pod is running and restarts it if it is not responding.
DIt verifies if the pod has enough memory to continue running.
Attempts:
2 left
💡 Hint

Think about what happens when a pod becomes unresponsive or stuck.

💻 Command Output
intermediate
1:30remaining
What is the output when a liveness probe fails repeatedly?

Given a pod with a liveness probe configured, what happens if the probe fails 3 times in a row?

AThe pod is deleted permanently and not restarted.
BThe pod is restarted by Kubernetes automatically.
CThe pod continues running but logs an error message.
DThe pod is scaled down to zero replicas.
Attempts:
2 left
💡 Hint

Consider Kubernetes behavior on failing health checks.

Configuration
advanced
2:00remaining
Identify the correct liveness probe configuration snippet

Which YAML snippet correctly configures an HTTP liveness probe on path /healthz with a 5-second initial delay?

A
livenessProbe:
  httpGet:
    path: /healthz
    port: 8080
  initialDelaySeconds: 5
  periodSeconds: 10
B
livenessProbe:
  exec:
    command: ["curl", "-f", "http://localhost:8080/healthz"]
  initialDelaySeconds: 5
C
livenessProbe:
  tcpSocket:
    port: 8080
  initialDelaySeconds: 5
  timeoutSeconds: 1
D
livenessProbe:
  httpGet:
    path: /status
    port: 8080
  initialDelaySeconds: 10
Attempts:
2 left
💡 Hint

Look for the HTTP GET probe with correct path and initial delay.

Troubleshoot
advanced
2:00remaining
Why does a pod keep restarting despite a working liveness probe?

A pod configured with a liveness probe keeps restarting even though the probe command returns success. What could be a likely cause?

AThe pod has insufficient CPU resources allocated.
BThe readiness probe is misconfigured, blocking traffic.
CThe liveness probe timeout is too short, causing false failures.
DThe pod's application is crashing due to internal errors unrelated to the probe.
Attempts:
2 left
💡 Hint

Think about causes of pod restarts beyond probe failures.

Best Practice
expert
2:30remaining
What is the recommended approach to avoid false positives in liveness probes?

Which practice helps prevent Kubernetes from restarting pods unnecessarily due to transient issues in liveness probes?

ASet a reasonable <code>initialDelaySeconds</code> and <code>failureThreshold</code> to allow startup and transient failures.
BConfigure the liveness probe to run every second for quick detection.
CUse only TCP socket probes as they are faster than HTTP or exec probes.
DDisable liveness probes and rely on manual pod restarts.
Attempts:
2 left
💡 Hint

Consider how to give the pod time to start and recover before restarting.