Lab 7.2 - Horizontal Pod Autoscaler

1. Login as the developer user

oc login -u developer -p rahasia

2. Make sure that you are in schedule-scale project

oc project schedule-scale

3. Verity the loadtest pod is running

oc get pods

4. Create a route to the application by exposing the service for the application

oc expose deployment/loadtest --port 80 --target-port 8080
oc get svc
oc describe svc loadtest

5. Create a route to access the application from an external network

oc expose service loadtest\

6. Create a horizontal pod autoscaler that ensures the loadtest application always has 2 application pods running;

oc autoscale deployment/loadtest \
 --min 2 --max 10 --cpu-percent 50

# that number can be increased to a maximum of 10 pods when CPU load exceeds 50%.

7. Verify that all pods for the loadtest application are running

oc get pods

8. Send several requests to your application, and then sort the responses to count the number of requests sent to each pod

curl -X GET \\

9. Check the status of the horizontal pod autoscaler running for the loadtest application.

oc get hpa/loadtest