-
Docker (Optional)
minikube profile quarkus-demos
minikube start -p quarkus-demos --memory=8192 --cpus=4 --disk-size=50g #(1)
eval $(minikube docker-env) #(2)-
Please add the other needed options as per your operating system
-
Make the current docker context to be that of minikube
We will use nexus for caching maven artifacts so that builds are faster.
kubectl apply -f k8s/nexus.yamlWait for some time to have nexus initialize and run. You can watch the status via kubectl get pods -w, use Ctrl+c to terminate the watch
|
Important
|
In both development and production mode, the container image will not be pushed to remote container registry. |
skaffold dev --file skaffold-dev.yaml --port-forward #(1)-
Run skaffold in
devmode. The port-forward option automatically forward the Kubernetes service port(default is 8080) to localhost port (default is 8080). By default it maps the application service port8080to host8080
|
Note
|
|
Once you see your application running alongside nexus (if you had deployed earlier):
NAME READY STATUS RESTARTS AGE
nexus-5585f7fcf6-jk6j7 1/1 Running 0 5h3m
skaffold-quarkus-helloworld-6f99cbb648-lsqwh 1/1 Running 0 5sTry opening the url http://locahost:8080/hello, which should show a message like Welcome to Quarkus!! from the GreetingResource.java
Now make any changes to the sources in your editor and try refreshing the browser you will see Quarkus live reload happening as usual on the terminal where you had started skaffold dev without the skaffold-quarkus-hello-world redeployed.
|
Tip
|
Though the demo application provides |
To run Quarkus application in production mode, we need to use the multi stage docker build; to build the quarkus application container image and use it in Kubernetes application deployment.
The following commands starts a one time deployment of Quarkus application with the port-forward and it also tails the logs from the application once its up and running.
|
Note
|
If you want to deploy Quarkus JVM image then run the following command before running skaffold: cp src/main/docker/Dockerfile.jvm DockerfileIf you want to deploy Quarkus Native image then run the following command before running skaffold: cp src/main/docker/Dockerfile.native Dockerfile |
|
Warning
|
You might face a build failure in pulling the image |
skaffold run --port-forward --tail