The Red Hat Certified Specialist in Containers and Kubernetes exam (EX180) tests your skills and knowledge of the fundamentals of containers and OpenShift, including the ability to find, customize, run, and manage containerized services in both standalone environments and environments with both Kubernetes and OpenShift. Now that you’ve gone through all the objectives, it is time to test your newfound knowledge on the practice exam to prepare for the real exam! In this lab, you will be asked to perform a series of tasks similar to what you will be asked to do in the actual exam. Good luck, and please use this practice exam as many times as you need before taking the exam.
*This course is not approved or sponsored by Red Hat.*
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Run and Manage Containers
Task 1.
- Configure
Podman
to search the registryregistry-1:5000
last. - Configure the registry as an insecure registry.
Task 2.
- Pull the latest Nginx image
docker.io/library/nginx
. - Start a container using the Nginx image with the following:
- Name =
web-vol
- Mount local directory
/home/cloud_user/web
to container as/usr/share/nginx/html
- Run the container in the pod named
task-2
by using the podman option--pod task-2
- Name =
- Verify you can access the web page by using
curl localhost:8081
. - Save a copy of the container logs to a file named
web-vol.log
.
Task 3.
- Pull the latest MySQL image
docker.io/library/mysql
. - Start a container using the MySQL image with the following:
name=mysql-llama
MYSQL_PASSWORD=badpass
MYSQL_USER=guru
MYSQL_ROOT_PASSWORD=supersecret
MYSQL_DATABASE=llama
- Publish port
3306
on the container to port3306
on the localhost
- Verify the MySQL instance is running with the following command, and check that the llama database is there:
echo "show databases;" | mysql -uguru -pbadpass --protocol tcp -h localhost
- Make a directory named
mysql_logs
and copy the log file/var/lib/mysql/mysql/general_log_213.sdi
to the directory.
Task 4.
- Start a Nginx container from
registry-1:5000
using a tag that is NOTlatest
. Use the following parameters:name=web-default
- Publish port
80
in the container tolocalhost
port8080
- Verify you can access the web page with
curl localhost:8080
. - Start a Bash shell on the container and modify
/usr/share/nginx/html/index.html
in the container, then change the current message toA guru was here!
. - Verify you can access the web page with
curl localhost:8080
and see your new message. - Commit the modified container to a new image named
registry-1:5000/nginx:web-guru
.
- Configure
- Build and Run Custom Images
Task 5.
Push your new image to
registry-1:5000
.Stop the container
web-default
and start a new container using your new image. Use the following parameters:name=web-guru
- Publish port
80
in the container tolocalhost
port8080
Verify you get your custom message with
curl localhost:8080
.Save your new image as a tar file named
guru-web.tar
.Task 6.
Complete the incomplete Dockerfile located at
/home/cloud_user/docker/Dockerfile
. Details are listed in the incomplete Dockerfile.
Task 7.
- Build an image from the completed Dockerfile in task 6. The image should be built with the following:
name=llama-cart
tag=v1
- Start a container with the new image using the following settings:
name=llama=web
- Publish port
90
in the container tolocalhost
port8090
- Verify the image works by putting your lab-system-name:8090 or IP-Address:8090 into a web browser.
- Alternatively, use
curl localhost:8090
and see just the text version of the page.
- Alternatively, use
- Creating Applications with OpenShift
Task 8.
- Create a new project.
- (CodeReady Containers only)
- Create a new project named
guru-php
with display name ofTest hello guru project
- (Red Hat OpenShift Sandbox)
- Skip this and use default project
username-dev
- Create a new project named
- (CodeReady Containers only)
- Create a new PHP application with the following:
- Git repo
- Use the Git repo context directory
php-hello-world
- Create app as a deployment config
- Label
app=hello-guru
Task 9.
- Create a new project.
- (CodeReady Containers only)
- Create a new project named
inventory
- (Red Hat OpenShift Sandbox)
- Create a new project named
- Skip this and use default project
username-stage
- Download the following template:
- Publish the template to the current project.
- Process the template and save to a file named
processed_template.yaml
. Set the following parameters and label:NAME=fruit-stand
DATABASE_NAME=fruit_stand
DATABASE_USER=guru
DATABASE_PASSWORD=badpass
DATABASE_ADMIN_PASSWORD=badidea
label app=guru-fruit
- Create the application using the saved file
processed_template.yaml
.
- (CodeReady Containers only)
Task 10.
- Create the following directories inside your home directory:
logs/pod-fruit-stand
logs/pod-postgres
- Sync the directory
/var/log
from each running pod to previously created directories.- Put the logs from the fruit-stand application pod in
logs/pod-fruit-stand
- Put the logs from the postgresql application pod in
logs/pod-postgres
- Put the logs from the fruit-stand application pod in
- Create a new project.