You can see how Kubernetes responds to pod failure by intentionally crashing your pod and making it unresponsive to the Kubernetes liveness probes.
Split your desktop screen between the OpenShift web console and the OSToy application web console so that you can see the results of your actions immediately.
If you cannot split your screen, open the OSToy application web console in another tab so you can quickly switch to the OpenShift web console after activating the features in the application.
From the OpenShift web console, select Workloads > Deployments > ostoy-frontend to view the OSToy deployment.
From the OSToy application web console, click Home in the left menu, and enter a message in the Crash Pod box, for example, This is goodbye!
.
Click Crash Pod.
The pod crashes and Kubernetes should restart the pod.
From the OpenShift web console, quickly switch to the Deployments screen. You will see that the pod turns yellow, meaning it is down. It should quickly revive and turn blue. The revival process happens quickly so you might miss it.
From the web console, click Pods > ostoy-frontend-xxxxxxx-xxxx to change to the pods screen.
Click the Events sub-tab and verify that the container crashed and restarted.
Keep the pod events page open from the previous procedure.
From the OSToy application, click Toggle Health in the Toggle Health Status tile. Watch Current Health switch to I’m not feeling all that well.
After the previous step, the application stops responding with a 200 HTTP code
. After 3 consecutive failures, Kubernetes will stop the pod and restart it. From the web console, switch back to the pod events page and you will see that the liveness probe failed and the pod restarted.
The following image shows an example of what you should see on your pod events page.
A. The pod has three consecutive failures.
B. Kubernetes stops the pod.
C. Kubernetes restarts the pod.