Chapter 5. Deploying a Quarkus application compiled to a native executable as a OpenShift Serverless service


As an application developer, you can deploy a Quarkus application compiled to a native executable on Red Hat OpenShift Container Platform using OpenShift Serverless Knative Serving.

By using OpenShift Serverless Knative Serving, you can scale services up and down depending on the load size. Scaling down services that are currently not requested improves memory capabilities.

Note

You can run Quarkus as a native executable or as a Java application using OpenJDK. For native executables, use the Red Hat UBI 8 minimal image. For OpenJDK, use the Red Hat 8 UBI Java image.

You can separate the native build, container build, and deployment steps when deploying a native serverless application. The following procedure demonstrates how to deploy a container image for a Quarkus native application in a continuous integration (CI) as a serverless application.

Prerequisites

  • OpenShift Serverless operator is installed.
  • OpenShift Knative Serving is installed.
  • For native compilation, a container environment like Podman or Docker is required.
  • The kn CLI tool is installed.

Procedure

  1. Change to the directory that contains your Quarkus project.
  2. Build a Linux executable using one of the following methods:

    1. For Docker use:

      ./mvnw package -Pnative -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=registry.access.redhat.com/quarkus/mandrel-20-rhel8:20.3
      Copy to Clipboard Toggle word wrap
    2. For Podman use:

      ./mvnw package -Pnative -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=podman -Dquarkus.native.builder-image=registry.access.redhat.com/quarkus/mandrel-20-rhel8:20.3
      Copy to Clipboard Toggle word wrap
  3. Open the src/main/docker/Dockerfile.native file and set the <image_name> and <version> parameters:

    1. For Docker use:

      docker build -f src/main/docker/Dockerfile.native -t <image_name>:<version> .
      Copy to Clipboard Toggle word wrap
    2. For Podman use:

      podman build -f src/main/docker/Dockerfile.native -t <image_name>:<version>.
      Copy to Clipboard Toggle word wrap
  4. Push the container to a repository that your CI environment and your OpenShift environment can access, where <registry> is your registry URL:

    1. For Docker use:

      docker tag <image_name>:<version> <registry>/<image_name>:<version>
      docker push <registry>/<image_name>:<version>
      Copy to Clipboard Toggle word wrap
    2. For Podman use:

      podman tag <image_name>:<version> <registry>/<image_name>:<version>
      podman push <registry>/<image_name>:<version>
      Copy to Clipboard Toggle word wrap
  5. Log in to the OpenShift CLI (oc):

    oc login
    Copy to Clipboard Toggle word wrap
  6. To create a new OpenShift project, enter the following command where <project_name> is the name of your new project:

    oc new-project <project_name>
    Copy to Clipboard Toggle word wrap
  7. To deploy your container as a serverless application using the OpenShift Serverless CLI (kn), enter the following command where <service_name> is the name for your service:

    kn service create <service_name> --image REPOSITORY/<image_name>:<version>
    Copy to Clipboard Toggle word wrap
  8. To verify that the service is ready, enter the following command.

    kn service list <service_name>
    Copy to Clipboard Toggle word wrap

    The output in the column called "READY" reads true if the service is ready.

    Note

    The kn service command returns true when the necessary components are created, not when the image is pulled down and ready.

Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2026 Red Hat
Back to top