💻 Tech
Services send traffic to the pods if the pod’s condition is Ready
. However, if the container is running, yet the application isn’t fully available to accept incoming traffic, it may result to issues like timeouts or delays. This is where readiness probe comes in. Readiness probe allows us to specify what kind of test to perform before a pod condition becomes Ready
.
Test can be in form of the following:
HTTP
readinessProbe:
httpGet:
path: /api/ready
port: 8080
TCP
readinessProbe:
tcpSocket:
port: 3306
Exec command
readinessProbe:
exec:
command:
- ./check_readiness
One example of how HTTP test is used:
apiVersion: v1
kind: Pod
...
spec:
containers:
- name: app
image: app
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /api/ready
port: 8080