liveBook · Manning

OpenShift

As explained in Quarkus in Action

OpenShift is a Kubernetes-based container application platform that provides managed development, deployment, and operations capabilities.

OpenShift is a Red Hat-branded Kubernetes platform used to deploy and operate containerized applications. Its additional resources, web console, and hosted Sandbox make it a practical target for moving Quarkus microservices from local development to a cloud deployment. Most Kubernetes deployment concepts still apply. section 11.3.4 section 11.0

For Quarkus, image building and deployment-resource generation are related but distinct tasks. The OpenShift image builder uploads a packaged application and its dependencies to the cluster, where OpenShift builds the image through source-to-image (s2i). The quarkus-openshift extension generates deployment manifests, including OpenShift-specific resources, so they need not be written entirely by hand. section 11.2 section 11.3.4 section 11.8

Listing 11.15 Continuation of the simplified generated openshift.yml
---
apiVersion: build.openshift.io/v1
kind: BuildConfig
  ...
  name: inventory-service
  namespace: default
spec:
  output:
    to:
      kind: ImageStreamTag
      name: inventory-service:1.0.0-SNAPSHOT
  source:
    binary: {}
  strategy:
    sourceStrategy:
      from:
        kind: ImageStreamTag
        name: openjdk-21:1.20
---
apiVersion: apps/v1
kind: Deployment
  ...
  name: inventory-service
  namespace: default
spec:
  ...
    spec:
      containers:
        ...
            - name: JAVA_APP_JAR
              value: /deployments/quarkus-run.jar
          image: quay.io/quarkus-in-action/inventory-service:1.0.0
          imagePullPolicy: Always

A simplified generated manifest shows a BuildConfig accepting a binary upload, producing an ImageStreamTag, and accompanying a Deployment. section 11.3.4

A single-service deployment can follow these steps:

  • Install the OpenShift client, oc, and log in to a cluster. Sandbox supplies a web-console login flow and a token-based oc login command; OpenShift Local is another option for experimentation. section 11.6.1 section 11.3.4
  • Add quarkus-openshift. If another image-building extension is present, remove it or select OpenShift with quarkus.container-image.builder=openshift. section 11.3.4
  • Configure the generated resources, such as datasource environment variables and quarkus.openshift.route.expose=true for a public route. Apply target/kubernetes/openshift.yml with oc apply, then inspect pods and routes with oc get. section 11.3.4
  • Alternatively, package with the production and s2i profiles and set quarkus.openshift.deploy=true to trigger the cluster build and deployment. section 11.3.4 section 11.8

Deploying connected microservices

For a car-rental system with five Quarkus services, add the extension and OpenShift configuration to each service. Replace localhost dependencies with Service hostnames: an internal reservation endpoint can use http://reservation-service. Generated Service resources map application container ports to port 80 externally. Configure database, messaging, tracing, and authentication endpoints through manifest environment variables; browser requests to Keycloak require its public route. The full deployment can then be automated or applied as a manifest. section 11.6.3 section 11.8

Sandbox is intended for development and testing, not presented as a production cluster. Its stated allocation is 14 GB of RAM and 40 GB of storage for 30 days. An existing image configuration may also need clearing in an s2i profile before cluster builds work as intended. section 11.6 section 11.3.4

How Quarkus in Action covers it

How deep it goes
Works through client login, extension selection, generated resources, configuration, deployment, and verification; does not detail OpenShift cluster administration.
Examples
Uses an Inventory service with MySQL, then five connected car-rental services deployed to OpenShift Sandbox.
What it assumes
Assumes a prepared Quarkus service and introduces the OpenShift client login and deployment configuration needed to run it on a cluster.
What you can do after
Operate/configure it to deploy Quarkus services through generated manifests or s2i and verify their pods and routes with oc.
How it connects
Connects Kubernetes, container images, source-to-image, BuildConfig, ImageStreams, Services, Routes, and configuration environment variables.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quarkus in Action. The section links point to the parts of the book it draws on.