Kubernetes Guide

This guide covers:

  • The deployment of the application to Kubernetes

  • The deployment of the application to OpenShift

This guide takes as input the application developed in the native application guide. So, you should have been able to package your application as a binary executable, copied it in a Docker image and run this image.

Depending on whether you are a bare Kubernetes user or an OpenShift user, pick the section you need. The OpenShift section leverages OpenShift builds and routes features which are not available in bare Kubernetes.


For this guide you need:

  • roughly 10 minutes (20 minutes if you want to deploy the application on both platforms)

  • having access to a Kubernetes and/or OpenShift cluster. Minikube and Minishift are valid options.

  • being able to package the docker image from the native application guide


We recommend to follow the instructions in the next sections and build the application step by step. However, you can go right to the completed example.

Clone the Git repository: git clone https://github.com/quarkusio/quarkus-quickstarts.git, or download an archive.

The solution is located in the getting-started directory.

Deploying the application in Kubernetes

First, you need to push the Docker image (created in the previous guide) to the image registry of your Kubernetes cluster. Depending on your cluster, there are several ways. For minikube, execute:

# For minishift use "eval $(minishift docker-env)" instead
eval $(minikube docker-env)

docker build -f src/main/docker/Dockerfile.native -t quarkus-quickstart/quickstart .

Once the image has been pushed to the Kubernetes image registry, instantiate the application as follows:

kubectl run quarkus-quickstart --image=quarkus-quickstart/quickstart:latest --port=8080 --image-pull-policy=IfNotPresent
kubectl expose deployment quarkus-quickstart --type=NodePort

The application is now exposed as an internal service. If you are using minikube, you can access it using:

curl $(minikube service quarkus-quickstart --url)/hello

Deploying the application in OpenShift

In this section, we are going to leverage the build mechanism of OpenShift. Run:

# To build the image on OpenShift
oc new-build --binary --name=quarkus-quickstart -l app=quarkus-quickstart
oc patch bc/quarkus-quickstart -p '{"spec":{"strategy":{"dockerStrategy":{"dockerfilePath":"src/main/docker/Dockerfile.native"}}}}'
oc start-build quarkus-quickstart --from-dir=. --follow

# To instantiate the image
oc new-app --image-stream=quarkus-quickstart:latest

# To create the route
oc expose service quarkus-quickstart

# Get the route URL
export URL="http://$(oc get route | grep quarkus-quickstart | awk '{print $2}')"
echo "Application URL: $URL"
curl $URL/hello && echo

Your application is accessible at the printed URL.

Going further

This guide covered the deployment of a Quarkus application on Kubernetes and OpenShift. However, there is much more, and the integration with these environments has been tailored to make Quarkus applications execution very smooth. For instance, the health extension can be used for health check; the configuration support allows mounting the application configuration using config map, the metric extension produces data scrappable by Prometheus and so on.