Running Quarkus and Camel Quarkus on Microshift

1 minute read

This week, I did a quick POC to experiment running a Quarkus and Camel Quarkus application on Microshift. Microshift is a Kubernetes-based solution that provides a lightweight, low-footprint way to develop and run edge applications.

TThis blog post assumes that readers are already familiar with Quarkus, Apache Camel, and Microshift.

Context

I created very quickly a Quarkus application. It has these 2 fonctionnalities:

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {
        return "Hello from RESTEasy Reactive on Microshift";
    }
  • A simple Camel Route, with a basic Camel Timer, logging “Hello from RESTEasy Reactive on Microshift”
     from("timer:foo?period=&delay=")
        .log("Hello! I'm running #ApacheCamel & #Quarkus on Microhsift");

I installed Microshift on my computer, as well as the Kubernetes CLI and OpenShift CLI.

Installing the application on Microshift

I have built my docker image and pushed it to my docker hub: zbendhiba/camel-quarkus-iot-jvm:1.0.

To deploy the application in Microshift, I’ve created the Kubernetes deployment file. You may consider updating the kubernetes.yml file and set the right namespace name. I’m using the namespace default.

Installing the application on Microshift.

$ kubectl apply -f kubernetes.yml

Make sure the pod is running.

$ kubectl get pods
NAME                                    READY   STATUS    RESTARTS   AGE
camel-quarkus-iot-jvm-d46b967c4-c6lq6   1/1     Running   1          2d22h

Accessing the RESTEasy Reactive endpoint

Open a shell in the running container by running the following command:

$ oc rsh <pod-name>

Replace with the name of the pod running your application.

Once you’re in the container, you can use curl to test the RESTEasy Reactive endpoint, by running the following command :

$ curl localhost:8080/hello
Hello from RESTEasy Reactive on Microshift

Now you can exit :

$ exit

Accessing the Timer Camel Consumer log

Open a shell in the running container by running the following command:

$ oc logs <pod-name>

Replace with the name of the pod running your application.

This shows the log of stating application, but also many line of logs containing INFO [route1] (Camel (camel-1) thread #1 - timer://foo) Hello! I'm running #ApacheCamel & #Quarkus on Microhsift.

End

Now that the experiment is finished, we can delete the app.

$ kubectl delete all -l app.kubernetes.io/name=camel-quarkus-iot-jvm

Comments