Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Try Camel K in the Developer Sandbox for Red Hat OpenShift

March 30, 2023
Bruno Meseguer
Related topics:
IntegrationKubernetes
Related products:
Developer SandboxRed Hat OpenShift

Share:

    You can now try Camel K in the Developer Sandbox for Red Hat OpenShift, an OpenShift environment you can access for a free, hands-on experience in building and deploying cloud-native applications quickly. This article will guide you to the Developer Sandbox and through a Camel K integration in a fully web-based experience—no local installs needed.

    If you are unfamiliar with Camel K, it is a subproject of Apache Camel, which many know as the Swiss Army knife of integration. Camel K simplifies the process of running cloud-native integration flows in Kubernetes environments.

    What’s so special about Camel K?

    Many organizations and developers implement microservices with varied languages and frameworks, but they usually forget the existence of purpose-built technologies such as Apache Camel, packed with hundreds of connectors and out-of-the-box patterns to resolve typical and challenging integration scenarios, such as content-based routing, splitting or data aggregation, protocol bridging, data transformation, and so on.

    Camel K was designed to encapsulate the key concepts of running integrations on containers, providing a significant degree of automation to simplify the process of creating, building, deploying, and operating integration flows in Kubernetes environments.

    Usually, applications are defined in a complex project tree and include dependency descriptors to incorporate libraries necessary to run the application. Camel K, on the other hand, aims to simplify the project to let the developer focus on the process flow definition. It automatically analyzes the code to find needed dependencies and only requires the essential flow definitions and resources from the developer.

    Access the Developer Sandbox

    Follow these instructions to get started in the Developer Sandbox: How to access the Developer Sandbox for Red Hat OpenShift

    Once you have your browser connected to the Developer Sandbox console, you’ll be all set to start the first part of this article’s tutorial.

    Part 1: Roll the dice

    The most straightforward way to get started with Camel K is from the Developer view. Follow the instructions below to deploy a “Hello world” example.

    From the Developer view, click +Add in the left menu, and scroll down to the Developer Catalog to find the Operator Backed category, as shown in Figure 1.

    add operator
    Figure 1: Add 'Operator Backed' from the Developer Catalog.

    Locate the Integration resource in the catalog, as illustrated in Figure 2:

    • Use the filter (type “integration”)
    • Click on the Integration tile, then click the blue Create button that appears from the right.

    select integration
    Figure 2: Find the Integration resource.

    Click on the Configure via YAML view radio button. You will then be presented with a definition screen similar to the one shown in Figure 3.

     

    YAML view
    Figure 3: YAML view.

    By selecting the YAML view, the interface lets you edit the definition and create the integration directly on the screen. This is a manual procedure that is very helpful when playing with the technology for the first time.

    The default Camel route definition is very simplistic; let’s make it a bit more interesting so that you can start experiencing the Camel K operator in action.

    Replace the default specification  (spec definition) with the following snippet:

    spec:
      traits:
        knative-service:
          enabled: false
      flows:
        - from:
            uri: 'platform-http:/roll-dice'
            steps:
              - set-body:
                  simple: 'roll: ${random(1,6)}'

    Note: by default, Camel K deploys the integration as a Knative service (serverless). In this example, we disable Knative to have full control over the route creation. 

    In the preceding code, the from element exposes an HTTP entry point for a service called roll-dice that will serve random numbers from 1 to 6 when clients submit HTTP requests.

    Click Create.

    When you create an integration as just described, the definition gets stored in your OpenShift project (namespace). Behind the scenes, the Camel K operator, deployed elsewhere, has visibility and picks up your definition to trigger a build and deployment on your project. This process takes some time.

    To monitor the state of the integration deployment, open a terminal from where you can obtain information from the environment via the command line. Click the terminal icon at the top of your screen and then click the Start button below to initialize the terminal, as shown in Figure 4.

    Open the terminal for Camel K
    Figure 4: Initialize the terminal.

    When you start the terminal, a new pod deploys. This is where your terminal is running.

     

    Work terminal
    Figure 5: Terminal running.

    On your terminal, type:

    oc get integration -w

    The flag -w indicates to watch the resource for changes.

    As the work progresses, its state will transition from Building Kit to Deploying to Running.

    You should see an output similar to the following:

    bash-4.4 ~ $ oc get integration -w
    NAME      PHASE          KIT                        REPLICAS
    example   Building Kit   kit-cdl6pa788ih7pmdvn6c0
    example   Deploying      kit-cdl6pa788ih7pmdvn6c0
    example   Running        kit-cdl6pa788ih7pmdvn6c0   0
    example   Running        kit-cdl6pa788ih7pmdvn6c0   1
    example   Running        kit-cdl6pa788ih7pmdvn6c0   1
    example   Running        kit-cdl6pa788ih7pmdvn6c0   1

     

    When the deployment completes, a new pod will run your integration definition:

     

    Pod running the example
    Figure 6: Pod running the example.

    What’s interesting in this deployment is that the Camel K operator has the intelligence to recognize you’re exposing an HTTP endpoint and automatically deploys a Kubernetes service named example.

    To test the service from within OpenShift, you can invoke it from the terminal. Enter the following cURL command and execute:

    curl http://example/roll-dice

    The command should return the value produced by the Camel integration. Executing it multiple times will produce random numbers from 1-6, simulating the dice rolling each time.

    By default, the Developer Sandbox does not expose the service automatically to external consumers. If you want the service to be externally accessible, you can simply enable an OpenShift route by running the following command:

    oc create route edge --service example --path=/roll-dice

    The command above uses the OpenShift client oc to create a route that points to your new Camel example service, to expose to the external world.

    Now you can also call the roll-dice service from your browser as if you were an external consumer. Notice the little icon attached to the Camel’s pod round graphic; click on it.

     

    Camel K pod
    Figure 7: Camel example service.

    In your browser, it should look similar to Figure 8.

    browser roll dice
    Figure 8: The browser.

    If you click the Reload button several times, you’ll see different values displayed.

    When you’re done, to clean up your working project, delete your integration with the simple command shown below:

    oc delete integration example

    You also need to delete the route you manually created by executing:

    oc delete route example

    Part 2: Inside OpenShift Dev Spaces

    If you want to play with Camel K in a more traditional developer workflow using a code editor and a terminal, the Developer Sandbox ships with an entire web-based IDE called Red Hat OpenShift Dev Spaces (formerly Red Hat CodeReady Workspaces).

    Set up your dev environment with the Camel tutorials

    The animated sequence in Figure 9 illustrates the actions to follow to open your development environment along with your tutorial instructions.

    gif to open dev tutorial
    Figure 9: The Dev Spaces UI.

    Follow these steps:

    1. From the web console, click the Applications icon as shown in Figure 9 (marked 1).
    2. Select Red Hat OpenShift Dev Spaces (2).
      You will be prompted to log in and Authorize Access; select the "Allow selected permissions" option.
    3. When the Create Workspace dashboard in OpenShift Dev Spaces opens, copy the snippet below:

      https://github.com/RedHat-Middleware-Workshops/devsandbox-camel.git

      Then, paste it into the Git Repo URL field (3).

    4. Click Create & Open (4).
    5. When the workspace finishes provisioning and the IDE opens, click the deployable Endpoints accordion (5).
    6. Then, click on the icon (6), which opens the tutorial in a new browser tab.
    7. Choose the tutorial indicated in the next section.

    Start the Camel K tutorial

    Select the Camel K - User Demo tile, highlighted in Figure 10.

    Camel K tutorial
    Figure 10: Locating the Camel K tutorial.

    When you click on the tile, the Solution Explorer will show the lab introduction and the exercise chapters included, which you should be able to complete in around 15 minutes.

    The aim of this use case demo is to help you get started with the basics of Camel K and play in the Developer Sandbox. For that reason, the use case selected is simple and friendly. The sequence diagram in Figure 11 illustrates the flow you’re about to create; you’ll get to see for yourself how little effort is required to complete it.

    sequence diagram
    Figure 11: The Camel K flow.

    Enjoy the Camel ride!

    More Apache Camel resources

    This article ends here, but this should only be the start of your journey with Apache Camel. The Developer Sandbox for Red Hat OpenShift gives you the opportunity to play on a Kubernetes-based application platform with an integrated developer IDE (OpenShift Dev Spaces).

    With your browser alone, you can quickly complete the Camel K lab and see by yourself how simply Camel resolves a typical use case and how easy it is to test, containerize, and run applications in OpenShift.

    Camel K is a convenient way to build and deploy integrations with Apache Camel. Its simplicity and ease of use accelerate developers. You might, however, find other Camel runtimes better suited for more advanced use cases. We encourage you to check out the resources below to learn more about Camel K and explore different ways you can build applications with Apache Camel:

    • Play with more tutorials in the Developer Sandbox for Red Hat OpenShift.
    • A good place to start learning about Camel K is the Camel K topic page on Red Hat Developer.
    • Learn how to implement a complete API integration using Camel K and AtlasMap.
    • Learn more about the different Camel runtimes available by reading Choose the best Camel for your integration ride.
    • Read Boost Apache Camel performance with Quarkus for a detailed look at Camel Quarkus.
    • Visit the Red Hat Integration page on developers.redhat.com to see complementary capabilities around Camel.
    OSZAR »
    Last updated: March 7, 2024

    Related Posts

    • Choose the best Camel for your integration ride, Part 1

    • Design event-driven integrations with Kamelets and Camel K

    • Boost Apache Camel performance on Quarkus

    • Normalize web services with Camel K and AtlasMap, Part 1

    • Integrating systems with Apache Camel and Quarkus on Red Hat OpenShift

    • Try Camel on Quarkus in the Developer Sandbox for Red Hat OpenShift

    Recent Posts

    • How to integrate vLLM inference into your macOS and iOS apps

    • How Insights events enhance system life cycle management

    • Meet the Red Hat Node.js team at PowerUP 2025

    • How to use pipelines for AI/ML automation at the edge

    • What's new in network observability 1.8

    What’s up next?

    Learn how to use Kafka in your app without installing it! Follow this step-by-step experience for using Red Hat OpenShift Streams for Apache Kafka from code running in a different cluster on the Developer Sandbox for Red Hat OpenShift.

    Start the activity
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue

    OSZAR »