Junior
What types of probes exist for checking the status of services and applications?
sobes.tech AI
Answer from AI
There are several common types of probes:
-
Liveness Probe: Determines if the application is running. If the probe fails, Kubernetes restarts the pod. Used to detect hung processes.
- HTTP Get Probes: Send HTTP GET requests to a specified path and port.
- TCP Socket Probes: Check the ability to connect to a specified port.
- Exec Probes: Execute a command inside the container and check the return code.
-
Readiness Probe: Determines if the pod is ready to accept traffic. If the probe fails, the service does not send traffic to this pod. Used to determine application readiness after startup or during updates.
- Uses the same mechanisms as Liveness Probes (HTTP Get, TCP Socket, Exec).
-
Startup Probe: Determines if the application initialization has completed. If configured, Kubernetes will not perform Liveness and Readiness probes until the Startup Probe succeeds. Useful for slow-starting applications to prevent premature restarts by Liveness Probe.
- Uses the same mechanisms as other probes.
Example configuration in Kubernetes:
livenessProbe: # Liveness check
httpGet: # Via HTTP
path: /healthz # Path
port: 8080 # Port
initialDelaySeconds: 15 # Delay before the first check
timeoutSeconds: 1 # Response timeout
readinessProbe: # Readiness check
tcpSocket: # Via TCP
port: 8080 # Port
initialDelaySeconds: 5 # Delay before the first check
periodSeconds: 10 # Interval between checks