Highly inspired from ko, a similar tool for deploying any Java microservices (uber jars) as Kubernetes application
Important
|
Under active development so lots change and at times breaking :D |
-
kind - to run your local Kubernetes cluster
-
Java 11
-
Maven 3.6.3+
Note
|
If you are using Docker for Windows, then Windows subsytem for Linux (WSL) is recommended. |
git clone https://github.com/kameshsampath/jo
cd jo
export $PROJECT_HOME=`pwd`
./mvnw clean install -DskipTests
Important
|
Currently the application is tested only with local clusters. Working on to add support to hosted clusters |
$PROJECT_HOME/bin/start-kind.sh
cd $PROJECT_HOME
java -jar target/jo-runner.jar apply --file="$PWD/examples/kubernetes/deployment-jbang.yaml"
The command above should do the deployment of the jbang script github.com/kameshsampath/jo/examples/http/server.java as Kubernetes application.
Important
|
Since quarkus does not do uberjar by default, you need to configure Quarkus app to build uberjar so that the runner jar is deployed with classifier: <plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<!-- Make your application deployable as uber jar -->
<configuration>
<uberJar>true</uberJar>
</configuration>
</plugin> |
cd $PROJECT_HOME
java -jar target/jo-runner.jar apply --file="$PWD/examples/kubernetes/deployment-quarkus.yaml"
The command above should do the deployment of the Quarkus Applicationt github.com/kameshsampath/jo-quarkus-helloworld as Kubernetes application.
cd $PROJECT_HOME
java -jar target/jo-runner.jar apply --file="$PWD/examples/kubernetes/deployment-spring-boot.yaml"
The command above should do the deployment of the Quarkus Applicationt github.com/kameshsampath/jo-sb-helloworld as Kubernetes application.
Wait for the hello-world pod to come up:
watch kubectl get pods
Once the pods is up try creating the Service and Ingress to access it:
cd $PROJECT_HOME
kubectl apply --filename="$PROJECT_HOME/examples/kubernetes/service.yaml"
Now doing curl localhost/greeting should show a response like Hello World or Hello from Quarkus or Hello from SpringBoot
cd $PROJECT_HOME
java -jar target/jo-runner.jar apply --file="$PWD/examples/knative/service-jbang.yaml"
The command above should do the Knative service deployment of the jbang script github.com/kameshsampath/jo/examples/http/server.java as Kubernetes application.
cd $PROJECT_HOME
java -jar target/jo-runner.jar apply --file="$PWD/examples/knative/service-quarkus.yaml"
The command above should do the Knative service deployment of the Quarkus Application github.com/kameshsampath/jo-quarkus-helloworld as Kubernetes application.
cd $PROJECT_HOME
java -jar target/jo-runner.jar apply --file="$PWD/examples/knative/service-spring-boot.yaml"
The command above should do the Knative service deployment of the Quarkus Applicationt github.com/kameshsampath/jo-sb-helloworld as Kubernetes application.
Wait for the greeter Knative service to come up:
watch kubectl get pods
Once Knative service is up access the service using:
SVC_URL=$(kubectl get ksvc greeter -ojsonpath="{.status.url}")
# the curl will return an Hello World response
curl $SVC_URL
The curl $SVC_URL
should show a response like Hello World or Hello from Quarkus or Hello from SpringBoot