How to create a Camel integration and deploy it as a serverless service

This activity, created by Kah Hoe Lai, walks through how to create an Apache Camel integration and deploy it as a serverless service using the VS Code extension Karavan.

Launch a new workspace in Red Hat OpenShift Dev Spaces and execute a command inside the pod

We will create a Camel file using Red Hat OpenShift Dev Spaces and Karavan, scaffold a Quarkus project using the JBang command-line interface (CLI), package it as container images, and deploy it as a Knative serverless service in Red Hat OpenShift (Figure 1).

Diagram showing the technologies used in this activity: Karavan, Camel, JBang, Quarkus, Source2Image, Maven, Knative, OpenShift.
Figure 1: The technologies used in this activity.

The application we will develop is a simple Knative service running a Camel route that logs the HTTP body and replies back the same content to the Curl command (Figure 2).

The simple flow for our final result.
Figure 2: The simple flow for our final result.

What you need

What you will learn

  • How to access the Developer Sandbox
  • How to create a workspace in OpenShift Dev Spaces
  • How to execute a command

Get started

First, get your no-cost, 30-day OpenShift sandbox environment.

  1. Once you successfully log in to the Developer Sandbox, select Red Hat OpenShift Dev Spaces from the menu (Figure 3). 

    The menu link to Red Hat OpenShift Dev Spaces.
    Figure 3: The menu link to Red Hat OpenShift Dev Spaces.
  2. The Create Workspace tab will appear. Under Select a Sample, launch an Empty Workspace (Figure 4). 

    The OpenShift Dev Spaces Catalog.
    Figure 4: The OpenShift Dev Spaces Catalog.
  3. From the menu, scroll down to Terminal, then select New Terminal (Figure 5). 

    Scroll down to Terminal then select New Terminal.
    Figure 5: Scroll down to Terminal, then select New Terminal.
  4. Run the command lscpu. You are now running the command inside a pod (Figure 6a). 

    The lscpu command and its outputs when executed in x86_64 OpenShift.
    Figure 6a: The lscpu command and its outputs when executed in x86_64 OpenShift.

    Info alert: The output shows that you are running in the pod, depending on where the pod is and which CPU architecture OpenShift is sitting on, not your laptop.

    For example, if you run lscpu in OpenShift running in ppc64le, you will see something like Figure 6b. 

    The lscpu command and outputs when executed in ppc64le OpenShift.
    Figure 6b: The lscpu command and outputs when executed in ppc64le OpenShift.
  5. Run the command to install the latest JBang CLI (Figure 7).

    curl -Ls https://sh.jbang.dev | bash -s - app setup
    source ~/.bashrc
    jbang version
    JBang is successfully installed.
    Figure 7: JBang is successfully installed.

Congratulations! You have successfully launched an empty workspace in OpenShift Dev Spaces and executed a command inside the pod.

Previous resource
Overview: How to create a Camel integration and deploy it as a serverless service
Next resource
Install the Karavan extension, then scaffold a new Camel project