This project is an example of Quarkus remoteDevMode over Kind. Basically Quarkus allows you to update your application code on the fly and do a hot deployment into Kubernetes
- Java17
- Docker
- kubectl
- Kind (K3s)
- golang
- Quarkus Cli (Optional)
Kind is a single kubernetes node, deployed as a docker instance. To install kind just compile the sources and moves the generated binary to /usr/local/bin
Install Kind commands example
compile kind
go install sigs.k8s.io/kind@v0.18.0
moves the generated bits to /usr/local/bin
mv ~/go/bin/kind /usr/local/bin/kind
double check that is installed: kind --version
In order to know more about how to install kind please take a look the official documentation
We are going to deploy our Quarkus app under a service that is exposed through a nodePort
so our cluster is going to be listening on port 8080
and pointing to containerPort: 30771
as is described in Kind documentation
extraPortMappings:
- containerPort: 30771
hostPort: 8080
protocol: TCP
The full kind cluster custom config are located under kind/kind-example-config.yaml
kind create cluster --config kind/kind-example-config.yaml
kubectl cluster-info --context kind-kind
In order to run / hotDeploy
our application into a Kind
cluster we will need to deploy Quarkus as a mutable-jar
using docker Jib
plus some other required configuration, as environment QUARKUS_LAUNCH_DEVMODE=true
or quarkus.live-reload.password
.
Everything is well explained on the official site.
RemoteDevMode application.properties
example:
# Required by remoteDevMode
quarkus.package.type=mutable-jar
quarkus.live-reload.password=changeit
quarkus.jib.environment-variables.QUARKUS_LAUNCH_DEVMODE=true
The rest of the configuration are not remarkable in my opinion
quarkus.container-image.build=true
quarkus.kubernetes.deploy=true
quarkus.kubernetes.namespace=default
quarkus.kubernetes.node-port=30771
We are using the fixed nodePort that we set previously.
-
Compile your app
gradle clean build
-
Run your app in remote devMode
gradle quarkusRemoteDev -Dquarkus.live-reload.instrumentation=true -Dquarkus.live-reload.url=http://localhost:8080
-
Verify that you see something like this into your logs
> :qu2023-04-08 17:41:20,974 INFO [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation completed in 11684ms
<====2023-04-08 17:41:21,319 INFO [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending lib/deployment/appmodel.dat
2023-04-08 17:41:21,326 INFO [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending app/quarkus-application.jar
2023-04-08 17:41:21,329 INFO [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending quarkus-run.jar
2023-04-08 17:41:21,330 INFO [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Connected to remote server
Now you can start making changes into your code and will be re-deployed after receive a request.
kind delete cluster