Getting started with Camel K tutorial

Welcome to this tutorial on Apache Camel K, a new open-source integration platform that enables you to build, deploy and manage cloud-native integration patterns effortlessly. Whether you’re a seasoned developer or just starting your journey, this tutorial will guide you through the basics of Camel K and teach you how to harness its power to create efficient, scalable and robust integration solutions.

What is Camel K ?

The idea of Camel K is bare simple: let developers use the Enterprise Integration Patterns (EIP) natively on Kubernetes, expressing them using the powerful Camel DSL. As Camel K requires using Kubernetes we will test in with minikube (it will work just the same with OpenShift).

The procedure for installing Minikube is detailed at:

As first step, start minikube:

minikube start

With Minikube running, the next step is to deploy the registry, which is an addon maintained by Google.

minikube addons enable registry

To start using Camel K you need the “kamel” shell tool, that is available into the release page for the latest version of the camel-k-client tool:

Download and uncompress the archive. and put the binary file “kamel” in your system’s path. For example, in /usr/bin.

Now, you can proceed with the installation:

kamel install

When the installation is completed, you should be to see the camel-k operator in your Kubernetes’ pods:

kubectl get pods

NAME                               READY   STATUS    RESTARTS   AGE
camel-k-operator-789b74c76-4q6d6   1/1     Running   0          3m48s

There are plenty of available examples in . For example, let’s give a run to

import org.apache.camel.builder.RouteBuilder;

public class Sample extends RouteBuilder {
  public void configure() throws Exception {
    from("timer:tick").log("Hello Camel K!");

In order to run this sample Camel Route, you can use the “run” option. We will also add the “–dev” flag to allow live reload of code:

$ kamel run --dev 

The Camel Route will soon start:

camel k tutorial

Notice you don’t need to specify any dependency specification in the folder, Camel K will figure it out, and inject it during the build. So all you need is to JUST write your application.

Also, as we are running in dev mode, that allow users to create integration incrementally and with immediate “buildless” redeploys. For example, change just the log message in the sample class:

public void configure() throws Exception {
  from("timer:tick").log("Hello Camel K just changed!");

The application will be updated automatically as you save the code:

[1] 2021-01-20 08:43:49,811 INFO  [route1] (Camel (camel-1) thread #0 - timer://tick) Hello Camel K just changed!

We can be even more adventurous, we will use a property file to define the content of the message.Let’s edit a file named to have this content:

message=Hello World from Camel K!

And change the class accordingly:

import org.apache.camel.builder.RouteBuilder;

public class Sample extends RouteBuilder {
  public void configure() throws Exception {

In order to use the external property file, just add the option –property-file at start up:

$ kamel run --property-file --dev

And here’s back your original log message:

[1] 2021-01-20 08:48:29,496 INFO  [route1] (Camel (camel-1) thread #0 - timer://tick) Hello World from Camel K!

Languages support in Camel-K

Camel-K is not just for java. Several other languages are supported, such as:

  • Groovy (currently the preferred language for writing Camel K integration code)
  • Kotlin
  • Java
  • XML
  • JavaScript

Just have a look at the hello.groovy example:

   .setBody().constant("Hello from Camel K in Groovy!!!")   

As you can see the code is even more concise. To run the Groovy example, you can use the same command line option:

$ kamel run hello.groovy --dev

And that’s it:

INFO  [message] (Camel (camel-1) thread #0 - timer://tick) Exchange[ExchangePattern: InOnly, BodyType: String, Body: Hello from Camel K in Groovy!!!]


Wee have learned how to build, deploy and manage cloud-native applications with Camel-K. You now have a better understanding of the features, benefits and use cases of Camel K and can apply this knowledge to develop efficient and scalable integration solutions. Check out the Camel-K documentation to learn more:

Found the article helpful? if so please follow us on Socials
Twitter Icon       Facebook Icon       LinkedIn Icon       Mastodon Icon