Junior
How many types of probes are there in Kubernetes?
sobes.tech AI
Answer from AI
Three types of probes in Kubernetes:
- livenessProbe: Determines when a container is unhealthy. If the probe fails, kubelet kills the container and manages its restart according to the restart policy.
- readinessProbe: Determines if the container is ready to handle requests. If the probe fails, kubelet stops sending traffic to this pod until the probe succeeds.
- startupProbe: Determines if the container has completed initialization. If specified, other probes (liveness and readiness) are disabled until this probe succeeds. This is useful for slow-starting containers, preventing their termination or disconnection from the service until they are ready.
Each probe type can be implemented using three mechanisms:
exec: Executes a specified command inside the container. The probe is successful if the command exits with a code 0.httpGet: Performs an HTTP GET request to the specified IP address, port, and path. The probe is successful if the response code is between 200 and 399.tcpSocket: Performs a TCP check on the specified port of the container. The probe is successful if the port is open.