|
| 1 | +:_mod-docs-content-type: ASSEMBLY |
| 2 | +[id="cloud-experts-deploying-application-health-check"] |
| 3 | += Tutorial: Health Check |
| 4 | +include::_attributes/attributes-openshift-dedicated.adoc[] |
| 5 | +:context: cloud-experts-deploying-application-health-check |
| 6 | + |
| 7 | +toc::[] |
| 8 | + |
| 9 | +//rosaworkshop.io content metadata |
| 10 | +//Brought into ROSA product docs 2024-01-26 |
| 11 | + |
| 12 | + |
| 13 | +You can see how Kubernetes responds to pod failure by intentionally crashing your pod and making it unresponsive to the Kubernetes liveness probes. |
| 14 | + |
| 15 | +== Preparing your desktop |
| 16 | + |
| 17 | +. 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. |
| 18 | ++ |
| 19 | +image::5-ostoy-splitscreen.png[Splitscreen desktop with the OSToy application and the web console] |
| 20 | ++ |
| 21 | +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. |
| 22 | + |
| 23 | +. From the OpenShift web console, select *Workloads > Deployments > ostoy-frontend* to view the OSToy deployment. |
| 24 | ++ |
| 25 | +image::5-ostoy-deployview.png[The web console deployments page] |
| 26 | + |
| 27 | +== Crashing the pod |
| 28 | + |
| 29 | +. 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!`. |
| 30 | + |
| 31 | +. Click *Crash Pod*. |
| 32 | ++ |
| 33 | +image::5-ostoy-crashpod.png[OSToy crash pod selection] |
| 34 | ++ |
| 35 | +The pod crashes and Kubernetes should restart the pod. |
| 36 | ++ |
| 37 | +image::5-ostoy-crashmsg.png[OSToy pod crash message] |
| 38 | + |
| 39 | +== Viewing the revived pod |
| 40 | + |
| 41 | +. 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. |
| 42 | ++ |
| 43 | +image::5-ostoy-podcrash.gif[Deployment details page] |
| 44 | + |
| 45 | +.Verification |
| 46 | + |
| 47 | +. From the web console, click *Pods > ostoy-frontend-xxxxxxx-xxxx* to change to the pods screen. |
| 48 | ++ |
| 49 | +image::5-ostoy-events.png[Pod overview page] |
| 50 | + |
| 51 | +. Click the *Events* sub-tab and verify that the container crashed and restarted. |
| 52 | ++ |
| 53 | +image::5-ostoy-podevents.png[Pod events list] |
| 54 | + |
| 55 | +== Making the application malfunction |
| 56 | + |
| 57 | +Keep the pod events page open from the previous procedure. |
| 58 | + |
| 59 | +* 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*. |
| 60 | ++ |
| 61 | +image::5-ostoy-togglehealth.png[OSToy toggle health tile] |
| 62 | + |
| 63 | +.Verification |
| 64 | + |
| 65 | +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. |
| 66 | + |
| 67 | +The following image shows an example of what you should see on your pod events page. |
| 68 | + |
| 69 | +image::5-ostoy-podevents2.png[Pod events list] |
| 70 | + |
| 71 | +*A.* The pod has three consecutive failures. |
| 72 | + |
| 73 | +*B.* Kubernetes stops the pod. |
| 74 | + |
| 75 | +*C.* Kubernetes restarts the pod. |
0 commit comments