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 11: Build and Deploy an Application from Source Code Using the OpenShift Web Console

Lab Objective

In this lab, you will build and deploy a web application from source code stored in a Git repository using the OpenShift web console.

You will use OpenShift Local, also known as CRC, as the local OpenShift environment.

This lab replaces the older Developer Sandbox-based lab and updates the steps for a local OpenShift learning environment.

By the end of this lab, you will understand how OpenShift takes application source code from Git, builds a container image using Source-to-Image, deploys the application, creates a Service, creates a Route, and makes the application accessible from a browser.


What You Will Learn

You will learn how to:

  1. Start OpenShift Local.
  2. Log in to the OpenShift web console.
  3. Create a new OpenShift project.
  4. Import application source code from a Git repository.
  5. Use OpenShift Source-to-Image, also called S2I.
  6. Build a container image from application source code.
  7. Deploy the built image as a Kubernetes Deployment.
  8. Expose the application internally using a Service.
  9. Expose the application externally using a Route.
  10. View the application in a browser.
  11. Inspect BuildConfig, Build, ImageStream, Deployment, Pod, Service, and Route resources.
  12. View build logs and pod logs.
  13. Trigger a rebuild manually.
  14. Troubleshoot common build and deployment issues.
  15. Clean up the lab environment.

Lab Architecture

The lab follows this flow:

Git Repository
     |
     v
OpenShift Import from Git
     |
     v
Source-to-Image Build
     |
     v
BuildConfig
     |
     v
Build Pod
     |
     v
ImageStream
     |
     v
Deployment
     |
     v
Pod
     |
     v
Service
     |
     v
Route
     |
     v
Browser
Code language: JavaScript (javascript)

OpenShift Resources Created in This Lab

When you import the application from Git, OpenShift creates several resources automatically.

ResourcePurpose
ProjectIsolates the lab resources
BuildConfigDefines how the source code will be built
BuildRepresents one build execution
ImageStreamTracks the built application image inside OpenShift
DeploymentRuns the application as pods
ReplicaSetMaintains the desired number of pods for the Deployment
PodRuns the application container
ServiceProvides stable internal access to the pod
RouteProvides browser access to the application from outside the cluster

Important Concept: What Is Source-to-Image?

Source-to-Image, usually called S2I, is an OpenShift build strategy.

With S2I, you provide source code from Git. OpenShift combines that source code with a builder image, such as a Node.js builder image, and creates a runnable container image.

In simple words:

Source Code + Builder Image = Runnable Application Image

For this lab:

Node.js source code + Node.js S2I builder image = Node.js application container image

Important Concept: Why Use Deployment Instead of DeploymentConfig?

Older OpenShift tutorials often used DeploymentConfig.

For current beginner labs, use Deployment.

A Deployment is the standard Kubernetes workload resource. It is easier for students to understand because it matches Kubernetes concepts directly.

In this lab, select:

Resource type: Deployment

Do not select:

DeploymentConfig

Lab Environment

This lab is written for:

OpenShift Local / CRC
OpenShift Container Platform 4.x
Developer user
OpenShift web console
oc CLI
Code language: JavaScript (javascript)

The exact OpenShift version may vary depending on the OpenShift Local version installed on your machine.


Part 1: Prerequisites

Required Software

You need:

  1. OpenShift Local installed.
  2. The crc command available.
  3. The oc command available.
  4. A browser.
  5. Internet access from the OpenShift Local VM to GitHub and container registries.

Recommended Machine Resources

For a smooth student lab, use at least:

ResourceRecommended
CPU4 cores or more
Memory12 GB or more
Disk35 GB or more

If your laptop has limited resources, builds may take longer.


Part 2: Start OpenShift Local

Open a terminal.

Check the CRC version:

crc version

Set CRC to use the OpenShift preset:

crc config set preset openshift
Code language: JavaScript (javascript)

Run setup:

crc setup

Start OpenShift Local:

crc start

The startup can take several minutes.

When the cluster starts, CRC prints the web console URL and login credentials.

To view the credentials again, run:

crc console --credentials
Code language: JavaScript (javascript)

To open the web console, run:

crc console
Code language: JavaScript (javascript)

Part 3: Configure the oc CLI

Run:

crc oc-env

On Linux or macOS, apply the printed command:

eval $(crc oc-env)
Code language: JavaScript (javascript)

On Windows PowerShell, use the command printed by crc oc-env for PowerShell.

Now log in as the developer user.

Get the password:

crc console --credentials
Code language: JavaScript (javascript)

Login command:

oc login -u developer https://api.crc.testing:6443
Code language: JavaScript (javascript)

Enter the developer password when prompted.

Verify the login:

oc whoami

Expected output:

developer

Check the node:

oc get nodes
Code language: JavaScript (javascript)

Expected output will look similar to this:

NAME                 STATUS   ROLES                         AGE   VERSION
crc-xxxxx-master-0   Ready    control-plane,master,worker    ...   v1.xx.x
Code language: CSS (css)

The exact node name and version will be different in your environment.


Part 4: Create a New Project

You can create the project from the web console or from the CLI.

Option A: Create Project from Web Console

  1. Open the OpenShift web console.
  2. Log in as:
Username: developer
Password: Use the password from crc console --credentials
Code language: JavaScript (javascript)
  1. Switch to the Developer perspective.
  2. Click the Project dropdown.
  3. Click Create Project.
  4. Enter the project name:
lab11-source-build
  1. Optional display name:
Lab 11 Source Build
  1. Click Create.

Option B: Create Project from CLI

Run:

oc new-project lab11-source-build
Code language: JavaScript (javascript)

Expected output:

Now using project "lab11-source-build" on server "https://api.crc.testing:6443".
Code language: JavaScript (javascript)

Verify:

oc project

Expected output:

Using project "lab11-source-build" on server "https://api.crc.testing:6443".
Code language: JavaScript (javascript)

Part 5: Import the Application from Git Using the Web Console

In the OpenShift web console:

  1. Make sure you are in the project:
lab11-source-build
  1. Switch to the Developer perspective.
  2. Click +Add.
  3. Under Git Repository, click From Git or Import from Git.

Depending on your OpenShift version, the label may appear as either:

From Git

or:

Import from Git
Code language: JavaScript (javascript)

Both refer to the same workflow.


Git Repository URL

In the Git repository URL field, enter:

https://github.com/redhat-developer-demos/sandbox-nodejs.git
Code language: JavaScript (javascript)

This is a simple Node.js application used for OpenShift S2I demonstration.

After entering the URL, OpenShift validates the repository.


Git Options

For this beginner lab, keep the default Git options.

FieldValue
Git Repo URLhttps://github.com/redhat-developer-demos/sandbox-nodejs.git
Git ReferenceLeave blank
Context DirLeave blank
Source SecretLeave blank

Use Git Reference only when you want to build from a specific branch, tag, or commit.

Use Context Dir only when the application is inside a subdirectory of the Git repository.

Use Source Secret only when the Git repository is private.


Part 6: Select the Import Strategy

After the Git URL is validated, OpenShift tries to detect the correct build strategy.

For this lab, use:

Import Strategy: Builder Image

OpenShift should detect that the application is a Node.js application.

If it does not detect it automatically, select:

Builder Image: Node.js
Code language: CSS (css)

Use the latest available Node.js builder image version shown in your OpenShift web console.

The exact Node.js version available depends on your OpenShift Local version and sample image configuration.

For example, you might see versions such as:

Node.js 18
Node.js 20
Node.js 22
Code language: CSS (css)

Select the latest available stable version.


Part 7: Configure Application Details

Scroll down to the application configuration section.

Use the following values:

FieldValue
Application Namelab11-source-build
Namesandbox-nodejs
Runtime IconNode.js
Builder ImageNode.js
Resource TypeDeployment

If OpenShift auto-fills the names, you can keep the defaults as long as they are clear and unique.

For consistency in this lab, use:

Application Name: lab11-source-build
Name: sandbox-nodejs

Part 8: Configure Resources

In the Resources section, select:

Deployment

Do not select DeploymentConfig.

Why?

Because Deployment is the standard Kubernetes workload resource and is the preferred teaching choice for modern OpenShift labs.


Part 9: Create a Route

In the Advanced options section, make sure this option is enabled:

Create a route to the application

A Route gives the application a browser-accessible URL.

Without a Route, the application would still run inside the cluster, but you would not be able to open it easily from your browser.


Part 10: Create the Application

Review the form.

You should have:

SettingExpected Value
Projectlab11-source-build
Git Repo URLhttps://github.com/redhat-developer-demos/sandbox-nodejs.git
Import StrategyBuilder Image
Builder ImageNode.js
Application Namelab11-source-build
Namesandbox-nodejs
Resource TypeDeployment
Create RouteEnabled

Click:

Create

OpenShift now starts the build and deployment process.


Part 11: Watch the Build in the Web Console

After you click Create, OpenShift takes you to the Topology view.

You should see an application icon for:

sandbox-nodejs

During the build, the ring around the application may show a build or progress state.

Wait until the application is built and running.

This may take a few minutes on OpenShift Local.


Part 12: View Build Logs in the Web Console

To view the build logs:

  1. In Topology, click the sandbox-nodejs application.
  2. Look for the related build.
  3. Open the build details.
  4. Click Logs.

You should see OpenShift cloning the Git repository, installing dependencies, and assembling the application image.

Typical log stages include:

Cloning source code
Installing Node.js dependencies
Running S2I assemble process
Pushing image to internal registry
Build completed successfully
Code language: CSS (css)

Exact log text may differ depending on your builder image version.


Part 13: Verify the Application from the Web Console

In the Topology view:

  1. Wait until the application shows as running.
  2. Click the external link icon on the application.
  3. A browser tab should open.
  4. The Node.js application page should load.

If the page opens successfully, your source-code build and deployment worked.


Part 14: Verify Resources Using the CLI

Now validate the same result using the oc CLI.

Set the project:

oc project lab11-source-build

List the main resources:

oc get buildconfig,build,imagestream,deployment,pod,service,route
Code language: JavaScript (javascript)

You should see resources similar to:

buildconfig.build.openshift.io/sandbox-nodejs
build.build.openshift.io/sandbox-nodejs-1
imagestream.image.openshift.io/sandbox-nodejs
deployment.apps/sandbox-nodejs
pod/sandbox-nodejs-xxxxx
service/sandbox-nodejs
route.route.openshift.io/sandbox-nodejs

The exact pod and build names may be different.


Part 15: Check the BuildConfig

Run:

oc get bc
Code language: JavaScript (javascript)

Expected output:

NAME             TYPE     FROM          LATEST
sandbox-nodejs   Source   Git           1

Describe the BuildConfig:

oc describe bc sandbox-nodejs

Look for:

Strategy: Source
Source: Git
Output to: ImageStreamTag sandbox-nodejs:latest
Code language: CSS (css)

This confirms that OpenShift created a source build configuration.


Part 16: Check the Build

List builds:

oc get builds
Code language: JavaScript (javascript)

Expected output:

NAME               TYPE     FROM          STATUS     STARTED          DURATION
sandbox-nodejs-1   Source   Git           Complete   ...              ...

The build status should be:

Complete

View the build logs:

oc logs -f bc/sandbox-nodejs

If the build is already complete, this command still shows the latest BuildConfig logs.

You can also view logs for a specific build:

oc logs build/sandbox-nodejs-1

Part 17: Check the ImageStream

Run:

oc get imagestream
Code language: JavaScript (javascript)

Expected output:

NAME             IMAGE REPOSITORY                                                   TAGS     UPDATED
sandbox-nodejs   default-route-openshift-image-registry.apps-crc.testing/...        latest   ...
Code language: JavaScript (javascript)

The ImageStream tracks the image produced by the build.

OpenShift uses this image to deploy the application.


Part 18: Check the Deployment

Run:

oc get deployment
Code language: JavaScript (javascript)

Expected output:

NAME             READY   UP-TO-DATE   AVAILABLE   AGE
sandbox-nodejs   1/1     1            1           ...

Check rollout status:

oc rollout status deployment/sandbox-nodejs

Expected output:

deployment "sandbox-nodejs" successfully rolled out
Code language: JavaScript (javascript)

Describe the Deployment:

oc describe deployment sandbox-nodejs

This shows the image, labels, pod template, replica count, and rollout status.


Part 19: Check the Pod

Run:

oc get pods
Code language: JavaScript (javascript)

Expected output:

NAME                              READY   STATUS      RESTARTS   AGE
sandbox-nodejs-xxxxx              1/1     Running     0          ...

View pod logs:

oc logs deployment/sandbox-nodejs

Expected output may include Node.js or Express startup logs.

If the pod is not running, describe it:

oc describe pod -l app=sandbox-nodejs

Part 20: Check the Service

Run:

oc get svc
Code language: JavaScript (javascript)

Expected output:

NAME             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
sandbox-nodejs   ClusterIP   ...             <none>        8080/TCP   ...
Code language: HTML, XML (xml)

The Service provides stable internal access to the application inside the cluster.

The Service name is:

sandbox-nodejs

Inside the same project, other pods can reach the app using:

http://sandbox-nodejs:8080
Code language: JavaScript (javascript)

Part 21: Check the Route

Run:

oc get route
Code language: JavaScript (javascript)

Expected output:

NAME             HOST/PORT                                             PATH   SERVICES         PORT     TERMINATION   WILDCARD
sandbox-nodejs   sandbox-nodejs-lab11-source-build.apps-crc.testing            sandbox-nodejs   8080                   None

The exact hostname may be different.

Store the route URL:

APP_URL="http://$(oc get route sandbox-nodejs -o jsonpath='{.spec.host}')"
echo "$APP_URL"
Code language: PHP (php)

Test the application:

curl -I "$APP_URL"
Code language: JavaScript (javascript)

Expected output should include:

HTTP/1.1 200 OK
Code language: HTTP (http)

If your application redirects or returns another successful HTTP response, that is also acceptable.

Open the URL in your browser:

http://<route-hostname>
Code language: HTML, XML (xml)

Part 22: Understand What Happened

When you clicked Create, OpenShift performed several actions automatically.

Step 1: OpenShift Pulled Source Code from Git

OpenShift cloned the repository:

https://github.com/redhat-developer-demos/sandbox-nodejs.git
Code language: JavaScript (javascript)

Step 2: OpenShift Selected a Builder Image

Because this is a Node.js application, OpenShift used a Node.js builder image.

Step 3: OpenShift Created a BuildConfig

The BuildConfig stores the build definition.

It tells OpenShift:

Where the source code is
Which builder image to use
Where to push the built image
What triggers future builds
Code language: PHP (php)

Step 4: OpenShift Started a Build

The Build object represents one execution of the build.

Example:

sandbox-nodejs-1

Step 5: OpenShift Created an ImageStream

The ImageStream tracks the resulting image.

The app Deployment points to the image produced by the build.

Step 6: OpenShift Created a Deployment

The Deployment created the running application pod.

Step 7: OpenShift Created a Service

The Service provides internal access to the pod.

Step 8: OpenShift Created a Route

The Route provides external browser access to the application.


Part 23: Trigger a New Build Manually

You can manually trigger a rebuild.

Run:

oc start-build sandbox-nodejs

Expected output:

build.build.openshift.io/sandbox-nodejs-2 started

Watch the build:

oc logs -f bc/sandbox-nodejs

List builds again:

oc get builds
Code language: JavaScript (javascript)

Expected output:

NAME               TYPE     FROM          STATUS
sandbox-nodejs-1   Source   Git           Complete
sandbox-nodejs-2   Source   Git           Complete

This proves that the BuildConfig can be reused to produce a new application image.


Part 24: Scale the Application

Even though this lab focuses on building from source code, you can quickly verify that the result is a normal Kubernetes Deployment.

Scale to 2 pods:

oc scale deployment/sandbox-nodejs --replicas=2

Check pods:

oc get pods
Code language: JavaScript (javascript)

Expected result:

Two sandbox-nodejs pods should be running.

Scale back to 1 pod:

oc scale deployment/sandbox-nodejs --replicas=1

Check deployment:

oc get deployment sandbox-nodejs
Code language: JavaScript (javascript)

Expected result:

READY   1/1

Part 25: Optional CLI-Only Equivalent

The main lab uses the web console. However, it is useful to know the CLI equivalent.

To create a similar app from source code using the CLI, you could run:

oc new-app https://github.com/redhat-developer-demos/sandbox-nodejs.git --name=sandbox-nodejs
Code language: JavaScript (javascript)

Then expose it:

oc expose svc/sandbox-nodejs

Check the route:

oc get route sandbox-nodejs
Code language: JavaScript (javascript)

This is not the main method for this lab, but it helps students understand that the web console and CLI both create OpenShift resources.


Part 26: Student Validation Checklist

Students should confirm the following:

CheckCommandExpected Result
Current projectoc projectlab11-source-build
BuildConfig existsoc get bcsandbox-nodejs
Build completedoc get buildsBuild status Complete
ImageStream existsoc get issandbox-nodejs
Deployment readyoc get deploy1/1 ready
Pod runningoc get podsPod status Running
Service existsoc get svcsandbox-nodejs
Route existsoc get routeRoute hostname created
Browser worksOpen route URLApp page loads

Part 27: Full Validation Commands

Run these commands after completing the lab:

oc project lab11-source-build

echo "Checking BuildConfig..."
oc get bc sandbox-nodejs

echo "Checking Builds..."
oc get builds

echo "Checking ImageStream..."
oc get imagestream sandbox-nodejs

echo "Checking Deployment..."
oc get deployment sandbox-nodejs

echo "Checking rollout status..."
oc rollout status deployment/sandbox-nodejs

echo "Checking Pods..."
oc get pods -l app=sandbox-nodejs

echo "Checking Service..."
oc get svc sandbox-nodejs

echo "Checking Route..."
oc get route sandbox-nodejs

echo "Getting app URL..."
APP_URL="http://$(oc get route sandbox-nodejs -o jsonpath='{.spec.host}')"
echo "$APP_URL"

echo "Testing app..."
curl -I "$APP_URL"
Code language: PHP (php)

Expected result:

  1. BuildConfig exists.
  2. Build status is Complete.
  3. ImageStream exists.
  4. Deployment is available.
  5. Pod is running.
  6. Service exists.
  7. Route exists.
  8. curl -I returns an HTTP response.

Part 28: Troubleshooting

Problem 1: Git Repository URL Is Not Validated

Symptom

The web console does not validate the Git URL.

Possible Causes

  1. Internet connection issue.
  2. GitHub is blocked by network policy or firewall.
  3. Typo in the repository URL.
  4. OpenShift Local VM cannot reach GitHub.

Fix

Check the URL:

https://github.com/redhat-developer-demos/sandbox-nodejs.git
Code language: JavaScript (javascript)

Try opening the repository in your browser.

From CLI, check whether your OpenShift Local cluster is running:

crc status

Problem 2: Builder Image Is Not Detected

Symptom

OpenShift does not automatically detect Node.js.

Possible Causes

  1. Builder images are not available in your local OpenShift environment.
  2. The Cluster Samples Operator did not install sample image streams.
  3. The Git repository was not detected properly.

Fix

In the Import from Git page, manually select:

Import Strategy: Builder Image
Builder Image: Node.js
Code language: CSS (css)

If Node.js is not available, ask the instructor to check cluster sample image streams.

The instructor can check:

oc get imagestream -n openshift | grep -i node
Code language: JavaScript (javascript)

If no Node.js image stream exists, the OpenShift Local sample image configuration may need review.


Problem 3: Build Fails During npm Install

Symptom

The build starts but fails while installing Node.js dependencies.

Possible Causes

  1. Network issue while downloading npm packages.
  2. Temporary npm registry issue.
  3. Resource constraints in OpenShift Local.
  4. Builder image issue.

Fix

Check build logs:

oc logs -f bc/sandbox-nodejs

Check build status:

oc get builds
Code language: JavaScript (javascript)

Describe the failed build:

oc describe build sandbox-nodejs-1

Try the build again:

oc start-build sandbox-nodejs

Problem 4: Pod Is Not Running

Symptom

The build succeeds, but the pod does not become ready.

Fix

Check pods:

oc get pods
Code language: JavaScript (javascript)

Describe the pod:

oc describe pod -l app=sandbox-nodejs

Check logs:

oc logs deployment/sandbox-nodejs

Common causes:

  1. Application startup error.
  2. Wrong runtime port.
  3. Insufficient memory.
  4. Image pull issue.
  5. CrashLoopBackOff.

Problem 5: Route Opens but Browser Shows Error

Symptom

The route exists, but the application page does not load.

Fix

Check the route:

oc get route sandbox-nodejs
Code language: JavaScript (javascript)

Check the service:

oc get svc sandbox-nodejs
Code language: JavaScript (javascript)

Check endpoints:

oc get endpoints sandbox-nodejs
Code language: JavaScript (javascript)

If endpoints are empty, the Service is not pointing to a running pod.

Check pod labels:

oc get pods --show-labels
Code language: JavaScript (javascript)

Check service selector:

oc describe svc sandbox-nodejs

Problem 6: curl Does Not Work Locally

Symptom

The browser works but local curl fails, or curl works but browser fails.

Possible Causes

  1. DNS issue on local machine.
  2. Browser proxy or VPN issue.
  3. CRC networking issue.
  4. Application not ready yet.

Fix

Check CRC status:

crc status

Print route:

oc get route sandbox-nodejs
Code language: JavaScript (javascript)

Try again after a minute.


Problem 7: BuildConfig Not Found

Symptom

This command fails:

oc get bc sandbox-nodejs
Code language: JavaScript (javascript)

Possible Causes

  1. You are in the wrong project.
  2. The application name is different.
  3. The import failed.
  4. The web console created resources with a different name.

Fix

Check current project:

oc project

Switch to the correct project:

oc project lab11-source-build

List all BuildConfigs:

oc get bc
Code language: JavaScript (javascript)

List all resources:

oc get all
Code language: JavaScript (javascript)

Part 29: Cleanup

You can delete the application only, or delete the whole project.

For a lab environment, deleting the whole project is easiest.

Cleanup from Web Console

  1. Switch to the Developer perspective.
  2. Open the project:
lab11-source-build
  1. Go to Topology.
  2. Right-click the sandbox-nodejs application.
  3. Select Delete Application.
  4. Confirm the deletion.

This removes the application resources but may not remove every project-level object.


Cleanup from CLI

Delete the whole project:

oc delete project lab11-source-build
Code language: JavaScript (javascript)

Verify:

oc get project lab11-source-build
Code language: JavaScript (javascript)

Expected result:

Error from server (NotFound): projects.project.openshift.io "lab11-source-build" not found
Code language: JavaScript (javascript)

Part 30: Lab Summary

In this lab, you built and deployed an application from source code using the OpenShift web console.

You learned that OpenShift can:

  1. Pull source code from Git.
  2. Detect or use a builder image.
  3. Build a runnable container image using S2I.
  4. Store the built image in an ImageStream.
  5. Deploy the image as a Kubernetes Deployment.
  6. Run the application in a Pod.
  7. Expose the application internally using a Service.
  8. Expose the application externally using a Route.
  9. Allow rebuilds using a BuildConfig.

Part 31: Review Questions

Question 1

What is the purpose of Source-to-Image?

Answer

Source-to-Image builds a runnable container image by combining application source code with a builder image.


Question 2

What does a BuildConfig do?

Answer

A BuildConfig defines how OpenShift should build an application, including the source repository, build strategy, builder image, triggers, and output image.


Question 3

What is the purpose of an ImageStream?

Answer

An ImageStream tracks container images inside OpenShift and allows OpenShift resources to refer to images using tags such as latest.


Question 4

Why did we choose Deployment instead of DeploymentConfig?

Answer

Deployment is the standard Kubernetes workload resource and is the better choice for modern beginner labs.


Question 5

What is the purpose of a Service?

Answer

A Service provides stable internal network access to application pods.


Question 6

What is the purpose of a Route?

Answer

A Route exposes an application outside the OpenShift cluster using a browser-accessible hostname.


Question 7

Which command shows the latest build logs from a BuildConfig?

Answer

oc logs -f bc/sandbox-nodejs

Question 8

Which command manually triggers a new build?

Answer

oc start-build sandbox-nodejs

Question 9

Which command shows the external application URL?

Answer

oc get route sandbox-nodejs
Code language: JavaScript (javascript)

Question 10

Which command deletes the whole lab project?

Answer

oc delete project lab11-source-build
Code language: JavaScript (javascript)

Part 32: Instructor Notes

This lab is designed as a modern replacement for older OpenShift source-code build labs.

The old lab flow was based on Developer Sandbox. This replacement uses OpenShift Local so that students can practice locally.

This lab intentionally uses:

Deployment

instead of:

DeploymentConfig

This is better for students because it aligns with standard Kubernetes workload concepts.

The lab also uses a simple Node.js Git repository so students can focus on the OpenShift build process rather than database setup, application debugging, or complex runtime dependencies.

For a more advanced course, follow-up labs can cover:

  1. Building from a Dockerfile.
  2. Building from a private Git repository.
  3. Using source clone secrets.
  4. Using Git webhooks.
  5. Setting build triggers.
  6. Setting build CPU and memory limits.
  7. Rolling back deployments.
  8. Using OpenShift Pipelines.
  9. Using GitOps.
  10. Deploying multi-service applications.

Part 33: Instructor Pre-Validation Checklist

Before giving this lab to students, the instructor should run:

crc version
crc status
oc version
oc whoami
oc get nodes
Code language: JavaScript (javascript)

Check that the developer user can create projects:

oc auth can-i create projects

Check that Node.js builder image streams are available:

oc get imagestream -n openshift | grep -i node
Code language: JavaScript (javascript)

Create a test project:

oc new-project lab11-source-build-test
Code language: JavaScript (javascript)

Optionally test the CLI equivalent:

oc new-app https://github.com/redhat-developer-demos/sandbox-nodejs.git --name=sandbox-nodejs
oc expose svc/sandbox-nodejs
oc rollout status deployment/sandbox-nodejs
oc get route sandbox-nodejs
Code language: JavaScript (javascript)

Test the route:

APP_URL="http://$(oc get route sandbox-nodejs -o jsonpath='{.spec.host}')"
curl -I "$APP_URL"
Code language: JavaScript (javascript)

Clean up:

oc delete project lab11-source-build-test
Code language: JavaScript (javascript)

If these checks pass, the lab is ready for students.


Final Outcome

You have successfully built and deployed an application from source code using the OpenShift web console.

You now understand the complete OpenShift source-build workflow:

Git Repository
  -> Source-to-Image Build
  -> BuildConfig
  -> Build
  -> ImageStream
  -> Deployment
  -> Pod
  -> Service
  -> Route
  -> Browser

This is one of the most important OpenShift developer workflows because it allows developers to go from source code to a running application without manually writing a container image build command.

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 guide does a good job of introducing source-based builds in OpenShift, but it could also explore the challenges teams face after the initial setup. In larger environments, build performance, dependency management, and regular security scans become important for maintaining efficient pipelines. It would also be helpful to discuss how source builds can be integrated with GitOps workflows and automated promotion processes to ensure that the same tested artifacts move reliably through development, staging, and production environments.

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