CHEAT SHEET
Quarkus & Kubernetes I
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.
CREATING THE PROJECT [Link]
Flag to set if th e image sh ou ld be bu ilt, defau lts to false.
mvn "[Link]:quarkus-maven-plugin:1 .[Link]:create" \
-DprojectGroupId="[Link]" \ [Link]
-DprojectArtifactId="greeting" \ Flag to set if th e image sh ou ld be pu sh ed, defau lts to false.
-DprojectVersion="1 .0-SNAPSHOT" \
-DclassName="[Link]" \ Speci c bu ilders:
-Dextensions="kubernetes, jib" \
Jib
-Dpath="/hello"
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://[Link] arku [Link]/ 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:
NATIVE EXECUTABLE SUPPORT [Link]-jvm-image
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: [Link]-native-image
./mvnw package -Pnative -[Link]-build=true
Th e base image to u se for th e n ative bu ild, defau lts to
Or u sin g podman:
[Link]/ubi8/ubi-minimal.
./mvnw package -Pnative -[Link]-runtime=podman -
[Link]-build=true [Link]-arguments
Th e argu men ts to pass to Java, defau lts to -[Link]=[Link],-
[Link]=[Link].
CONTAINER IMAGE CREATION
[Link]-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 -
[Link]=[Link].
Dockerfi[Link]
[Link]-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).
Dockerfi[Link]
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/Dockerfi[Link] -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.
[Link]file-jvm-path
Stan dard properties th at can be set as Java system properties or in th e
src/main/resources/[Link]. Path to th e JVM Docker le, defau lts to
${[Link]}/src/main/docker/Dockerfi[Link].
[Link]
[Link]file-native-path
Th e grou p/repository of th e image, defau lts to ${[Link]}.
Path to th e n ative Docker le, defau lts to
[Link] ${[Link]}/src/main/docker/Dockerfi[Link].
Th e n ame of th e image, defau lts to th e application n ame.
[Link] S2I
Th e tag of th e image, defau lts to th e application version .
[Link] 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 [Link]. Speci c properties for th e S2I exten sion are:
[Link]
[Link]-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-
[Link] openjdk8-jre.
Th e registry passw ord. [Link]-native-image
[Link] 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. [Link]/ubi8/ubi-minimal.
Build here. Go any where. [Link] | @RHdevelopers
CHEAT SHEET
KUBERNETES
Qu arku s u se th e Dekorate project to gen erate Ku bern etes resou rces.
Ru n n in g ./mvnw package th e Ku bern etes resou rces are created at
target/kubernetes/ directory.
You can ch oose th e target deploymen t type by settin g th e
[Link]-target property. Possible valu es are kubernetes,
openshift an d knative. Th e defau lt target is kubernetes.
You can cu stomize th e gen erated resou rce by settin g speci c properties in
[Link]. Fu ll list of con gu rable elemen ts are:
h ttps://qu arku [Link]/gu ides/ku bern etes#con gu ration -option s
src/main /resou rces/application .properties
[Link]=3
[Link]-seconds=45
[Link]=/deployment/github
[Link]-only=true
[Link]-name=github-token
[Link]-name=greeting-security
[Link]-mode=420
[Link]fi[Link]fig-map-name=my-secret
[Link]=bar
[Link]=bar
[Link]=true
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
[Link] ag to true.
./mvnw clean package -[Link]=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:
[Link]-certs
Tru st self-sign ed certi cates, defau lts to false.
[Link]-url
URL of Ku bern etes API server.
[Link]
Defau lt n amespace.
[Link]-cert-file
CA certi cate data.
[Link]-cert-file
Clien t certi cate le.
[Link]-cert-data
Clien t certi cate data.
[Link]-key-data
Clien t key data.
[Link]-key-algorithm
Clien t key algorith m.
[Link]
Usern ame.
[Link]
Passw ord.
Author Alex Soto
Java Champion, Working at Red Hat
Build here. Go any where. [Link] | @RHdevelopers