Fail-fast
Fail-fast is a principle where a program reports a problem as soon as it notices it and stops the action, instead of silently carrying on with wrong data. The error shows up where it arose and is cheaper to find. Kubernetes builds service handling on this: a service fails right away on an error, and the system restarts it on its own and sends it no requests until it is ready.
Fail-fast in Kubernetes
- Crash on start · a service with a bad setting exits with an error at once instead of half-working. kubelet restarts the container and waits longer between repeated failures: a pod in CrashLoopBackOff is visible right away.
- Liveness probe · kubelet regularly asks the service “are you alive?”. No answer, and the container is restarted: a hung service does not hang silently.
- Readiness probe · until the service is ready, no customer requests reach it: Kubernetes removes the pod from the list of receivers.
- Halting a rollout · a Deployment replaces old pods with new ones in turn. If the new ones never become ready, the replacement goes no further, and the old copies keep running.
Frequently asked questions
What is fail-fast?
A principle where a program reports a problem right away and stops the action instead of silently carrying on.Why fail fast?
The error shows up where it arose, so it is cheaper to find and fix.Source: Wikipedia: Fail-fast system
Where it appears · 1
- Rice's theorem in plain words · Specs and context