Kahibaro
Discord Login Register

7 Building and Deploying Applications

Learning goals for this chapter

After this chapter you should be able to:

This chapter provides the foundation; the following subchapters will dive deeper into each major mechanism (S2I, container-based, DeploymentConfigs, rollouts, etc.).

The OpenShift view of “an application”

On OpenShift, “an application” is usually not a single object but a collection of resources:

Conceptually, OpenShift standardizes three phases:

  1. Build – how code becomes a container image.
  2. Deploy – how that image is run as pods.
  3. Release / expose – how users or other systems access it.

This chapter focuses on the first two: building and deploying.

Build models in OpenShift

OpenShift supports multiple ways to produce container images. The choice has a big impact on workflows, permissions, and automation.

1. In-cluster builds (OpenShift-native)

These are builds that run inside the cluster as Kubernetes pods and are managed by OpenShift.

Key native components:

Core strategies (explained in detail in later subchapters):

When you trigger a build (manually, via webhook, or automatically):

  1. OpenShift creates a Build object.
  2. A build pod runs the chosen build strategy.
  3. The resulting image is pushed to an internal registry and tracked via an ImageStream.

Advantages:

Trade-offs:

2. External CI/CD builds

In this model, building the image happens outside OpenShift:

Typical pattern:

  1. Developer pushes code.
  2. External CI builds and tests the image.
  3. CI pushes image to registry (e.g. Quay, Docker Hub, internal registry).
  4. CI calls oc apply / oc rollout or updates image tags to deploy on OpenShift.

Advantages:

Trade-offs:

3. Hybrid models

Organizations frequently mix approaches:

Understanding that OpenShift supports all these patterns is central to designing a workable application delivery process.

Deployment models in OpenShift

Once you have an image, OpenShift runs it as pods using workload controllers. On OpenShift, you will commonly see:

You will explore these in depth in the dedicated subchapter. For now, it’s important to understand:

Basic deployment workflow

Conceptually, a typical deployment goes through:

  1. Define the pod template
    • Container image (e.g. quay.io/org/app:1.0.3).
    • Environment variables, ports, resource requests/limits.
    • Configurations via ConfigMaps/Secrets/Volumes.
  2. Wrap the template in a controller
    • Use a Deployment or DeploymentConfig with:
      • replicas: how many pods.
      • strategy: how to roll out changes (rolling, recreate, etc.).
  3. Connect to the network
    • A Service provides stable DNS and load balancing across pods.
    • A Route or Ingress exposes the service externally if needed.
  4. Roll out changes
    • Update image tags, environment variables, or other fields.
    • The controller orchestrates creating new pods and scaling down old ones.

Application deployment approaches

From a developer’s point of view, there are two main ways to “get an app running”:

1. “Bring your own image” (container-based deployments)

You use a pre-built image, often produced by an external CI/CD system:

This is close to vanilla Kubernetes and is covered in detail later in “Container-based deployments”.

2. “Bring your source code” (S2I-based workflows)

You give OpenShift access to your source code repository and a builder image; OpenShift:

OpenShift’s web console and oc new-app strongly encourage this pattern:

This is the focus of the upcoming “Source-to-Image (S2I)” subchapter.

Integrating builds and deployments

A key benefit of OpenShift’s opinionated model is automated promotion from build to running application.

Typical integration mechanisms:

By combining these:

  1. Code is pushed → BuildConfig starts a build.
  2. Build produces a new image in an ImageStream.
  3. Image change trigger fires on the Deployment/DeploymentConfig.
  4. A rollout to the new version starts automatically.

This creates a basic in-cluster CI-like pipeline without external tooling. The CI/CD-focused chapter and subchapters will cover more advanced pipelines and GitOps patterns.

Environment separation and promotion

Most real deployments have multiple environments:

Common patterns for managing this in OpenShift:

This separation is essential for compliance and governance and is built into how many OpenShift clusters are organized.

Developer workflows on OpenShift

While the details differ by organization, a typical OpenShift-based developer workflow looks like:

  1. Initial onboarding
    • Get access to a project/namespace.
    • Choose a deployment model: S2I or container-based.
  2. First deployment
    • Use oc new-app or the web console to create a basic application.
    • Confirm pods, services, and routes are created and healthy.
  3. Iterative development
    • Modify code, push to Git.
    • Build and deploy automatically via:
      • OpenShift BuildConfigs, or
      • External CI/CD triggering oc commands or GitOps flows.
  4. Observability and tuning
    • Inspect logs, events, and metrics.
    • Adjust resource requests/limits and scaling.
    • Modify deployment strategy for faster or safer rollouts.
  5. Promotion to higher environments
    • Use pipelines, manual approvals, or GitOps to move changes toward production.

Later chapters (CI/CD, monitoring, security, scaling) will expand on each of these aspects; this chapter’s role is to show how the core building and deployment mechanisms underpin the whole workflow.

Design considerations for building and deploying on OpenShift

When deciding how to structure your builds and deployments, you should think about:

Each of the following subchapters will focus on one part of this overall picture—S2I, container-based deployments, DeploymentConfigs/Deployments, and rollout strategies—to give you practical tools for implementing robust application delivery on OpenShift.

Views: 55

Comments

Please login to add a comment.

Don't have an account? Register now!