In this lab scenario, you have been approached by a client who would like you to test the basic functionality of their new development Red Hat OpenShift Container Platform. The client would like you to complete the following tasks:
Create a project with the name test-db. The display name should be The first test project.
Create a new MySQL application in the project with a name of guru-mysql and label all created resources with guru-test. The MySQL database should be set up with the following configuration:
The DB name should be testdb.
The MySQL root password set to rootpass.
The MySQL user set to guru.
The MySQL user password set to badpass.
Create a route by exposing the new service.
Lastly, you will need to test that the new MySQL application is available and the DB can be accessed.
Upon completion of the lab, you can clean up the resources by running the following command: oc delete deployment.apps/guru-mysql service/guru-mysql route.route.openshift.io/guru-mysql
Good luck, and have fun, Gurus!
This assumes that you are logged in the OC envir
onment.
1 . Create a new project
oc new-project test-db –display-name=”The first test project””
2 Create a new application
oc new-app mysql -e MYSQL_DATABASE=testdb -e MYSQL_ROOT_PASSWORD=rootpass -e MYSQL_USER=guru -e MYSQL_PASSWORD=badpass
– name guru-mysql -l app=guru-test
3 Check status
oc status
oc get all
oc get pods
oc expose svc/guru-mysql or oc expose service guru-mysql
oc get route
oc get pods
oc rsh <pod-name></pod-name>
guru-sql-container > mysql -uguru -pbadpass
mysql> show databases;
exit
exit
gets you back to the host
oc delete deployment.apps/guru-mysql service/guru-mysql route.route.openshift.io/guru-mysql
or
oc delete project test-db
In this scenario, you have been tasked with making sure that a simple Apache web page can be built from a Git repository using a new OpenShift cluster. The client would like you to complete the following tasks
Create a project with the name llama-cart-test. The display name should be Llama Cart Racing test.
Create a new http application in the project with the following configuration:
1. Uses the image stream httpd to build the application.
2. Uses the client-provided Git repository with the context directory llama-cart.
oc new-app –name=llama-cart-racing httpd~https://github.com/linuxacademy/Red-Hat-Certified-Specialist-in-Containers-and-Kubernetes –context-dir=llama_cart -l app=”racing-test”
2.- Check the app status:
oc status
3.- Create a New Route
Create a new route to the application by exposing the new service:
oc expose service llama-cart-racing
Look up the new route:
oc get routes
curl -s <ROUTE_HOST_NAME>
You should now see the HTML of the Llama Cart Racing Club web page.</ROUTE_HOST_NAME>
Setup Multicontainer Application
In this lab scenario, you have been approached by a client who would like you to test a new multi-container application template using their new development Red Hat OpenShift Container Platform. The client would like you to complete the following tasks:
Create a new project.
Download the template file from this Git repo and publish it to your new project.
Process the template with custom parameters and use this to create the application.
Enter a test value into the web application to verify it is working properly.
curl https://raw.githubusercontent.com/linuxacademy/Red-Hat-Certified-Specialist-in-Containers-and-Kubernetes/main/multi-container/multi_test.yaml -o multi_test.yaml
List your file.
Note: If you are using OpenShift sandbox, exclude multi-test.yaml from the following command:
ls multi-test.yaml
clear your screen.
clear
oc create -f multi_test.yaml
3.- Verify the template is published:
oc get templates
clear your screen.
clear
oc process -f multi_test.yaml -o yaml -p NAME=fruit-stand -p DATABASE_NAME=fruit_stand -p DATABASE_USER=guru -p DATABASE_PASSWORD=badpass -p DATABASE_ADMIN_PASSWORD=badidea | oc create -f -
Scroll down towards the bottom and copy the HOST/PORT route (SERVICES would be fruit-stand) and paste it into a web browser.
curl fruit-stand-multi-test.apps.na410.prod.nextcle.com