Lab: Troubleshoot and Scale Applications

Navigate the OpenShift web console to identify CPU-consuming workloads.

Troubleshoot and fix a failed MySQL pod.

Manually scale an application.

Configure health probes.

Outcomes

You should be able to troubleshoot malfunctioning workloads, configure deployments, and scale applications.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

This command ensures that all resources are available for this exercise. The command also creates the compreview-scale project and deploys some applications in that project.

The command creates the /home/student/DO180/labs/compreview-scale/resources.txt file. The resources.txt file contains the URLs of your OpenShift cluster and the name of the images that you use during the exercise. You can use the file to copy and paste these URLs and image names.

[student@workstation ~]$ lab start compreview-scale

Specifications

The API URL of your OpenShift cluster is https://api.ocp4.example.com:6443, and the oc command is already installed on your workstation machine.

The URL of the OpenShift web console is https://console-openshift-console.apps.ocp4.example.com. When you access the web console, select Red Hat Identity Management as the authentication mechanism.

Log in to the OpenShift cluster as the developer user with the developer password. The password for the admin user is redhatocp.

Perform the following tasks to complete the comprehensive review:

  • A pod in the cluster is consuming excessive CPU and is interfering with other tasks. Identify the pod and remove its workload.

  • The compreview-scale project already includes a web application at http://frontend-compreview-scale.apps.ocp4.example.com. When you access this URL, the application returns a list of quotations from famous authors. The application is broken for now, and is missing some configuration to be ready for production.

    The application uses two Kubernetes Deployment objects. The frontend deployment provides the application web pages, and relies on the quotesdb deployment that runs a MySQL database. The lab command already created the services and routes that connect the application components and that make the application available from outside the cluster.

    Fix the application and make it ready for production:

    • The quotesdb deployment in the compreview-scale project starts a MySQL server, but the database is failing. Review the logs of the pod to identify and then fix the issue.

      Use the following parameters for the database:

      NameValue
      Username operator1
      Password redhat123
      Database name quotes
    • You security team validated a new version of the MySQL container image that fixes a security issue. The new container image is registry.ocp4.example.com:8443/rhel9/mysql-80:1-237.

      Update the quotesdb deployment to use this image. Ensure that the database redeploys.

      The classroom setup copied the image from the Red Hat Ecosystem Catalog. The original image is registry.redhat.io/rhel9/mysql-80:1-237.

    • Add a probe to the quotesdb deployment so that OpenShift can detect when the database is ready to accept requests. Use the mysqladmin ping command for the probe.

    • Add a second probe that regularly verifies the status of the database. Use the mysqladmin ping command as well.

    • Configure CPU and memory usage for the quotesdb deployment. The deployment needs 200 millicores of CPU and 256 MiB of memory to run, and you must restrict its CPU usage to 500 millicores and its memory usage to 1 GiB.

    • Add a probe to the frontend deployment so that OpenShift can detect when the web application is ready to accept requests. The application is ready when an HTTP request on port 8000 to the /status path is successful.

    • Add a second probe that regularly verifies the status of the web front end. The front end works as expected when an HTTP request on port 8000 to the /env path is successful.

    • Configure CPU and memory usage for the frontend deployment. The deployment needs 200 millicores of CPU and 256 MiB of memory to run, and you must restrict its CPU usage to 500 millicores and its memory usage to 512 MiB.

    • Scale the frontend application to three pods to accommodate for the estimated production load.

    • To verify your work, access the http://frontend-compreview-scale.apps.ocp4.example.com URL. The application returns a list of quotations from famous authors.

Evaluation

As the student user on the workstation machine, use the lab command to grade your work. Correct any reported failures and rerun the command until successful.

[student@workstation ~]$ lab grade compreview-scale

Finish

As the student user on the workstation machine, use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish compreview-scale