Quarkus Kubernetes Cheatsheet
Quarkus Kubernetes Cheatsheet
Th is ch eat sh eet covers th e in tegration s you can n d in th e form of exten sion s betw een Qu arku s an d Ku bern etes.
You can u se Jib to bu ild th e con tain er image. Jib bu ilds Docker an d OCI images
You can gen erate th e project in h ttps://code.qu arku s.io/ an d selectin g for Java application s in a dockerless fash ion .
Tip
kubernetes an d jib exten sion s. ./mvnw quarkus:add-extensions -Dextensions="jib"
Speci c properties for th e Jib exten sion are:
You can bu ild a n ative image by u sin g GraalVM. Bu t sin ce Ku bern etes w orks Th e base image to u se for th e Jib bu ild, defau lts to fabric8/java-alpine-
w ith con tain ers, you n eed to create th e n ative execu table in side a con tain er. openjdk8-jre.
Qu arku s allow s you to do th at by ru n n in g th e follow in g comman d: quarkus.container-image-jib.base-native-image
./mvnw package -Pnative -Dquarkus.native.container-build=true
Th e base image to u se for th e n ative bu ild, defau lts to
Or u sin g podman:
registry.access.redhat.com/ubi8/ubi-minimal.
./mvnw package -Pnative -Dquarkus.native.container-runtime=podman -
Dquarkus.native.container-build=true quarkus.container-image-jib.jvm-arguments
Th e argu men ts to pass to Java, defau lts to -Dquarkus.http.host=0.0.0.0,-
Djava.util.logging.manager=org.jboss.logmanager.LogManager.
CONTAINER IMAGE CREATION
quarkus.container-image-jib.native-arguments
Qu arku s comes w ith defau lt Dockerfiles to bu ild th e con tain er. Th ey are fou n d
in src/main/docker. Th e argu men ts to pass to th e n ative application , defau lts to -
Dquarkus.http.host=0.0.0.0.
Dockerfile.jvm
quarkus.container-image-jib.environment-variables
It can be u sed to create a con tain er con tain in g th e gen erated Java les (ru n n er
Map of en viron men t variables.
JAR + lib folder).
Dockerfile.native
It can be u sed to create a con tain er con tain in g th e gen erated n ative
Dock er
execu table le.
You can u se th e Docker exten sion to bu ild th e con tain er image u sin g Docker
You can u se Docker to create th e con tain er image: docker build -f CLI.
src/main/docker/Dockerfile.native -t quarkus/getting-started . or you can leverage ./mvnw quarkus:add-extensions -Dextensions="docker"
to Qu arku s th e creation an d release of th e con tain er images. Several exten sion s Speci c properties for th e Docker exten sion are:
are provided to make it so.
quarkus.container-image-docker.dockerfile-jvm-path
Stan dard properties th at can be set as Java system properties or in th e
src/main/resources/application.properties. Path to th e JVM Docker le, defau lts to
${project.root}/src/main/docker/Dockerfile.jvm.
quarkus.container-image.group
quarkus.container-image-docker.dockerfile-native-path
Th e grou p/repository of th e image, defau lts to ${user.name}.
Path to th e n ative Docker le, defau lts to
quarkus.container-image.name ${project.root}/src/main/docker/Dockerfile.native.
Th e n ame of th e image, defau lts to th e application n ame.
quarkus.container-image.tag S2I
Th e tag of th e image, defau lts to th e application version .
quarkus.container-image.registry You can u se th e S2I to bu ild th e con tain er image.
./mvnw quarkus:add-extensions -Dextensions="s2i"
Th e registry to u se for pu sh in g, defau lts to docker.io. Speci c properties for th e S2I exten sion are:
quarkus.container-image.username
quarkus.container-image-s2i.base-jvm-image
Th e registry u sern ame.
Th e base image to u se for th e s2i bu ild, defau lts to fabric8/java-alpine-
quarkus.container-image.password openjdk8-jre.
Th e registry passw ord. quarkus.container-image-s2i.base-native-image
quarkus.container-image.insecure Th e base image to u se for th e n ative bu ild, defau lts to
Flag to allow in secu re registries, defau lts to false. registry.access.redhat.com/ubi8/ubi-minimal.
KUBERNETES
Moreover, th e gen erated resou rces are in tegrated w ith MicroPro le Health spec,
registerin g liven ess/readin ess probes based on th e h ealth ch ecks de n ed u sin g
th e spec.
To deploy th e gen erated resou rces au tomatically, you n eed to set
quarkus.container.deploy ag to true.
./mvnw clean package -Dquarkus.kubernetes.deploy=true
Settin g th is ag to true, makes th e bu ild an d pu sh ags from th e container-
image set to true too.
Ku bern etes exten sion u ses th e Ku bern etes Clien t to deploy resou rces. By
defau lt, Ku bern etes Clien t reads con n ection properties from th e ~/.kube/config
folder bu t you can set th em too by u sin g some of th e kubernetes-client
properties:
quarkus.kubernetes-client.trust-certs
Tru st self-sign ed certi cates, defau lts to false.
quarkus.kubernetes-client.master-url
URL of Ku bern etes API server.
quarkus.kubernetes-client.namespace
Defau lt n amespace.
quarkus.kubernetes-client.ca-cert-file
CA certi cate data.
quarkus.kubernetes-client.client-cert-file
Clien t certi cate le.
quarkus.kubernetes-client.client-cert-data
Clien t certi cate data.
quarkus.kubernetes-client.client-key-data
Clien t key data.
quarkus.kubernetes-client.client-key-algorithm
Clien t key algorith m.
quarkus.kubernetes-client.username
Usern ame.
quarkus.kubernetes-client.password
Passw ord.