Observability - Readiness Probes Flashcards
What POD Status exist and what do they mean?
- Pending: when first created, scheduler tries to find a node for the pod, if none found stays in pending state
- ContainerCreating: once scheduled, images required are pulled and containers are started
- Running: Container running, till process fulfilled successfully etc,
What are POD Conditions and what do they do?
- complement pod status
- array of true or false status that tell us the state of a pod
Instances: - PodScheduled: pod scheduled on a node
- Initialized: when pod is initialized
- ContainersReady: when all containers in the pod are ready
- Ready: pod itself is read with everything, sometimes applications might still be ‘warming up’
Described in ‘kubectl describe pod …’
How does Kubernetes know that the application inside a container is actually running and available for input?
What kind of Readiness Probes exist?
- HTTP Test against URL/Endpoint
- TCP Test to see if port is open
- Exec command, to run a custom script that checks if application is ready
How do we define a Readiness probe?
pod-yaml:
~~~
…
spec:
containers:
- name:
readinessProbe: (http)
httpGet:
path: /api/ready
port: 8080
(optional) initialDelaySecons: 10
(optional) periodSeconds: 5
(optional) failureTreshold: 8
///
readinessProbe: (tcp)
tcpSocket:
port: 3306
///
readinessProbe: (exec)
exec:
command:
- cat
- /app/is_ready
~~~
What is the consequence of a ReadinessProbe?
Kubernetes does not set Status Ready as soon as pod is ready
- tests instead, whether the api respons positively
- until then, no traffic is forwarded to the pod
How are Readiness Probes useful in a multi-pod environment
- without, container would be shown ready, while app is still warming up
- service would immediately start routing requests to the still starting server