Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Openshift: Lab 7 – Scale applications using the oc CLI tool

Lab 7 summary

This lab teaches how to use the oc CLI to scale an OpenShift application up and down by changing the number of pod replicas in a Kubernetes/OpenShift Deployment. The sample app used is Parksmap, deployed from the container image:

quay.io/openshiftroadshow/parksmap

The lab first logs into Developer Sandbox using an oc login --token=... --server=... command copied from the OpenShift web console, then deploys the app, exposes it, checks the deployment, scales it to 3 replicas, and scales it back to 1 replica.

Main commands from the lab

# Login using token copied from OpenShift web console
oc login --token=<token> --server=<api-server>

# Deploy Parksmap from container image
oc new-app quay.io/openshiftroadshow/parksmap

# Expose the service
oc expose service/parksmap

# Check deployment
oc get deployment

# Scale up to 3 pods
oc scale deployment parksmap --replicas=3

# Verify scale-up
oc get deployment -l app=parksmap

# Scale down to 1 pod
oc scale deployment parksmap --replicas=1

# Verify scale-down
oc get deployment -l app=parksmap
Code language: PHP (php)

Expected outputs shown in the lab

After oc new-app quay.io/openshiftroadshow/parksmap, the lab shows output like:

imagestream.image.openshift.io "parksmap" created
deployment.apps "parksmap" created
service "parksmap" created
Code language: CSS (css)

Then OpenShift suggests exposing the app:

oc expose service/parksmap

Expected output:

route.route.openshift.io/parksmap exposed

For scale-up:

oc scale deployment parksmap --replicas=3

Expected output:

deployment.apps/parksmap scaled

Then:

NAME       READY   UP-TO-DATE   AVAILABLE   AGE
parksmap   3/3     3            3           43m

For scale-down:

oc scale deployment parksmap --replicas=1

Expected output:

deployment.apps/parksmap scaled

Then:

NAME       READY   UP-TO-DATE   AVAILABLE   AGE
parksmap   1/1     1            1           43m

Clean corrected version of Lab 7

There are two copy-paste wording issues in the PDF:

  1. It says “Install an application from source code using oc new-app, but the actual command uses a container image, not source code.
  2. It says the following sections describe using the web console, but this lab is actually about using the oc CLI.

The corrected lab flow should be:

# 1. Log in with token copied from OpenShift web console
oc login --token=<your-token> --server=<your-api-server>

# 2. Confirm user
oc whoami

# 3. Check current project
oc project

# 4. Deploy Parksmap from container image
oc new-app quay.io/openshiftroadshow/parksmap

# 5. Check created resources
oc get all

# 6. Expose the service as a route
oc expose service/parksmap

# 7. Get the route
oc get route parksmap

# 8. Check current deployment replica count
oc get deployment parksmap

# 9. Scale up to 3 pods
oc scale deployment parksmap --replicas=3

# 10. Verify scale-up
oc get deployment -l app=parksmap
oc get pods -l app=parksmap

# 11. Scale down to 1 pod
oc scale deployment parksmap --replicas=1

# 12. Verify scale-down
oc get deployment -l app=parksmap
oc get pods -l app=parksmap

# 13. Optional cleanup
oc delete all -l app=parksmap
oc delete route parksmap
Code language: PHP (php)

Difference from Lab 6

LabToolMain Skill
Lab 6OpenShift web consoleScale app using Topology UI
Lab 7oc CLIScale app using oc scale deployment

So yes: Lab 7 is the CLI version of Lab 6, using the same Parksmap-style scaling concept.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

Best DevOps Tools in 2024

here’s a clear, structured breakdown of the Best DevOps Tools (grouped by categories), so you can use it for learning, training, or posts. 🚀 Best DevOps Tools…

Read More

OpenShift Tutorial – Deploy and Access Your First Applications using OpenShift Local

How to install oc? OpenShift: How to Install OpenShift CLI oc How to login? Login to the Openshift using Web Console and CLI using oc Copy the admin…

Read More

OpenShift Lab 14: Setting Up and Using OpenShift Serverless Functions on OpenShift Local

Lab Objective In this lab, you will install and use OpenShift Serverless Functions on OpenShift Local. You will create a simple Node.js serverless function, deploy it to…

Read More

OpenShift Lab 13: Deploy a Java Spring Boot Application with MySQL Using the OpenShift Web Console

Lab Objective In this lab, you will deploy a Java Spring Boot application on OpenShift using the OpenShift web console. You will deploy two components: The Java…

Read More

OpenShift Lab 12: Deploy an Application from an Existing Container Image Using the OpenShift Web Console

Lab Objective In this lab, you will deploy an application on OpenShift from an existing container image. This lab is different from building an application from source…

Read More

OpenShift: How to Install OpenShift CLI oc

Option – 1 – REDHAT Websites URL – https://access.redhat.com/downloads/content/290/ver=4.18/rhel—9/4.18.11/x86_64/product-software Option – 2 – OKD Websites The OKD (Origin Community Distribution of Kubernetes for OpenShift) is the open-source…

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Skylar Bennett
Skylar Bennett
18 days ago

The lab demonstrates application scaling with the oc CLI effectively, but it could also discuss how scaling decisions are influenced by workload behavior in production. Simply increasing replica counts does not always improve performance, especially for stateful services or applications with external dependencies. Including topics such as autoscaling policies, resource requests and limits, and monitoring key metrics would give readers a better understanding of how to scale applications efficiently while controlling infrastructure costs and maintaining reliability.

1
0
Would love your thoughts, please comment.x
()
x