Is there a way to check the last time the liveness & readyness checks are done and what are the results of the same.
I check by doing
kubectl get pod my-pod -o yaml
The status section shows up like this but does not tell when the kubelet ran the health checks
conditions:
- lastProbeTime: null
lastTransitionTime: 2019-09-17T10:38:20Z
status: "True"
type: Initialized
- lastProbeTime: null
lastTransitionTime: 2019-09-17T10:38:35Z
status: "True"
type: Ready
- lastProbeTime: null
lastTransitionTime: 2019-09-17T10:38:35Z
status: "True"
type: ContainersReady
- lastProbeTime: null
lastTransitionTime: 2019-09-17T10:38:20Z
status: "True"
type: PodScheduled
containerStatuses:
- containerID: docker://<some link>
image: nginx:latest
imageID: someid
lastState: {}
name: nginx
ready: true
restartCount: 0
state:
running:
startedAt: 2019-09-17T10:38:22Z
hostIP: 172.18.3.8
phase: Running```
A Pod is considered ready when all of its Containers are ready. One use of this signal is to control which Pods are used as backends for Services. When a Pod is not ready, it is removed from Service load balancers.The kubelet uses readiness probes to know when a Container is ready to start accepting traffic.
you can use kubectl describe pod liveness-exec to view the pod events. The output should indicates if the liveness probes have failed. You can get more details on this from Kubernetes.io
Additionally, a Pod has a PodStatus, which has an array of PodConditions through which the Pod has or has not passed.
Two of the elements are