Junior — Middle
How can dependency injection be implemented in FastAPI and how is it used?
sobes.tech AI
Answer from AI
In Kubernetes, the readiness probe is used to notify when the application has successfully started and is ready to accept traffic. It is a special check performed by kubelet to determine if traffic can be directed to the pod.
The readiness probe can be implemented in various ways:
- HTTP request to a specific endpoint of the application
- Execution of a command inside the container
- TCP port check
Example configuration of readinessProbe in a Pod manifest:
readinessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
If the check is successful, Kubernetes considers the pod ready and directs traffic to it. If not, the pod is excluded from services, even though the container is running.