Deployment
This guide covers deploying Apache Camel applications to Kubernetes and OpenShift platforms.
đ For more details, see:
â ī¸ Requirements:
- Kubernetes or OpenShift
- Container registry access
- Maven 3.8+
- kubectl or oc CLI tools
âšī¸ Common Deployment Strategies:
- Camel JBang - Simplest approach with one-command deployment
- Maven Plugins - Eclipse JKube, Quarkus Kubernetes
Camel JBang Deployment
The simplest approach for deploying Camel applications to Kubernetes. It works for any of the Camel runtimes.
Setup
1
2
| # Install Kubernetes plugin
camel plugin add kubernetes
|
Direct Deployment
1
2
3
4
5
6
7
8
| # Deploy route directly to Kubernetes
camel kubernetes run MyRoute.java --image-registry=kind
# Deploy with specific runtime
camel kubernetes run MyRoute.java --runtime=quarkus --image-registry=docker.io/myuser
# Deploy to OpenShift
camel kubernetes run MyRoute.java --cluster-type=openshift
|
Development Mode
1
2
| # Deploy with auto-reload for development
camel kubernetes run MyRoute.java --dev --image-registry=kind
|
Export and Customize
1
2
3
4
5
6
7
| # Generate Kubernetes project
camel kubernetes export MyRoute.java --dir my-project --runtime=quarkus
# Build and deploy the generated project
cd my-project
mvn package -Dquarkus.container-image.build=true -Dquarkus.container-image.push=true
kubectl apply -f target/kubernetes/kubernetes.yml
|
đ Examples:
Discovery configuration for Camel Dashboard
To configure Camel application before deployment for Camel Dashboard add the following label to your export or run command:
1
| $ [...] --label="camel.apache.org/app=my-route"
|
If your Camel version in older than 4.12, you need to configure the business port:
1
| $ [...] --annotation="camel.apache.org/observability-services-port=8080"
|
You can add some additional non-optional configurations:
1
2
| # Configure custom SLI Exchange error and warning percentage
$ [...] --annotation="camel.apache.org/sli-exchange-error-percentage=1" --annotation="camel.apache.org/sli-exchange-warning-percentage=5"
|
Maven Plugin Deployments for Kubernetes
Quarkus Applications
Quarkus provides the most integrated Kubernetes experience with automatic manifest generation.
đ Examples:
Adding Kubernetes Support to Existing Project
For an existing Camel Quarkus project, add the Kubernetes extensions to your pom.xml
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| <dependencies>
<!-- Your existing Camel Quarkus dependencies -->
<!-- ... -->
<!-- Add Kubernetes integration -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-kubernetes</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-container-image-jib</artifactId>
</dependency>
</dependencies>
|
đ For more configuration options, see:
Configuration for Camel Dashboard
To configure Camel application before deployment for Camel Dashboard add the following label to your properties in application.properties
:
1
| quarkus.kubernetes.labels."camel.apache.org/app"=my-camel-app
|
If your Camel version in older than 4.12, you need to configure the business port:
1
| quarkus.kubernetes.annotations."camel.apache.org/observability-services-port"=8080
|
You can add some additional non-optional configurations:
1
2
3
| // Configure custom SLI Exchange error and warning percentage
quarkus.kubernetes.annotations."camel.apache.org/sli-exchange-error-percentage"=1
quarkus.kubernetes.annotations."camel.apache.org/sli-exchange-warning-percentage"=5
|
Build and Deploy
1
2
3
4
5
6
7
8
| # Build container image and generate manifests
mvn clean package -Dquarkus.container-image.build=true
# Build, push and deploy in one command
mvn clean package -Dquarkus.container-image.build=true -Dquarkus.container-image.push=true -Dquarkus.kubernetes.deploy=true
# Or deploy manually
kubectl apply -f target/kubernetes/kubernetes.yml
|
Native Image Deployment
1
2
| # Build native image for faster startup and smaller memory footprint
mvn clean package -Dnative -Dquarkus.container-image.build=true -Dquarkus.container-image.push=true
|
Spring Boot Applications
Eclipse JKube Plugin
Maven Configuration:
1
2
3
4
5
6
7
8
9
10
11
12
13
| <plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>kubernetes-maven-plugin</artifactId>
<version>${jkube-maven-plugin-version}</version>
<executions>
<execution>
<goals>
<goal>resource</goal>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
|
đ For more configuration options, see:
Build and Deploy:
1
2
3
4
5
6
7
8
9
10
11
| # Build Docker image
mvn k8s:build
# Generate Kubernetes manifests
mvn k8s:resource
# Deploy to Kubernetes
mvn k8s:apply
# All in one command
mvn clean package k8s:build k8s:resource k8s:apply
|
Configuration for Camel Dashboard
If you want to configure Camel application before deployment for Camel Dashboard add the following label to your properties in kubernetes-maven-plugin
configuration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| <plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>kubernetes-maven-plugin</artifactId>
<version>${jkube-maven-plugin-version}</version>
<configuration>
<!-- ... -->
<resources>
<labels>
<deployment>
<property>
<name>camel.apache.org/app</name>
<value>my-camel-app</value>
</property>
</deployment>
</labels>
</resources>
<!-- ... -->
</configuration>
<!-- ... -->
</plugin>
|
If your Camel version in older than 4.12, you need to configure the business port:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| <plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>kubernetes-maven-plugin</artifactId>
<version>${jkube-maven-plugin-version}</version>
<configuration>
<!-- ... -->
<resources>
<annotations>
<deployment>
<property>
<name>camel.apache.org/observability-services-port</name>
<value>8080</value>
</property>
</deployment>
</annotations>
</resources>
<!-- ... -->
</configuration>
<!-- ... -->
</plugin>
|
You can add some additional non-optional configurations:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
| <plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>kubernetes-maven-plugin</artifactId>
<version>${jkube-maven-plugin-version}</version>
<configuration>
<!-- ... -->
<resources>
<annotations>
<deployment>
<!-- Configure custom SLI Exchange error and warning percentage -->
<property>
<name>camel.apache.org/sli-exchange-error-percentage</name>
<value>1</value>
</property>
<property>
<name>camel.apache.org/sli-exchange-warning-percentage</name>
<value>5</value>
</property>
</deployment>
</annotations>
</resources>
<!-- ... -->
</configuration>
<!-- ... -->
</plugin>
|
Maven Plugin Deployments for Openshift
Quarkus Applications
For an existing Camel Quarkus project, add the Openshift extension to your pom.xml
:
1
2
3
4
5
6
7
8
9
10
| <dependencies>
<!-- Your existing Camel Quarkus dependencies -->
<!-- ... -->
<!-- Add Openshift integration -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-openshift</artifactId>
</dependency>
</dependencies>
|
đ For more configuration options, see:
Build and Deploy
1
2
3
4
5
6
7
8
| # Build container image and generate OpenShift manifests
mvn clean package -Dquarkus.container-image.build=true
# Build, push and deploy to OpenShift in one command
mvn clean package -Dquarkus.container-image.build=true -Dquarkus.container-image.push=true -Dquarkus.openshift.deploy=true
# Or deploy manually after build
oc apply -f target/kubernetes/openshift.yml
|
Native Image Deployment
Native images provide faster startup times and lower memory consumption, ideal for OpenShift environments:
1
2
3
4
5
| # Build native image for OpenShift
mvn clean package -Dnative -Dquarkus.container-image.build=true -Dquarkus.container-image.push=true -Dquarkus.openshift.deploy=true
# Build native image locally (requires GraalVM)
mvn clean package -Dnative -Dquarkus.native.container-build=true
|
Configuration for native builds:
1
2
3
4
| # application.properties
quarkus.native.container-build=true
quarkus.container-image.builder=jib
quarkus.openshift.deploy=true
|
Configuration for Camel Dashboard
To configure Camel application before deployment for Camel Dashboard add the following label to your properties in application.properties
:
1
| quarkus.openshift.labels."camel.apache.org/app"=my-camel-app
|
If your Camel version in older than 4.12, you need to configure the business port:
1
| quarkus.openshift.annotations."camel.apache.org/observability-services-port"=8080
|
You can add some additional non-optional configurations:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| // Configure custom SLI Exchange error and warning percentage
quarkus.openshift.annotations."camel.apache.org/sli-exchange-error-percentage"=1
quarkus.openshift.annotations."camel.apache.org/sli-exchange-warning-percentage"=5
`
### Spring Boot Applications
#### Eclipse JKube Plugin
**Maven Configuration:**
```xml
<plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>openshift-maven-plugin</artifactId>
<version>${jkube-maven-plugin-version}</version>
<executions>
<execution>
<goals>
<goal>resource</goal>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
|
đ For more configuration options, see:
Commands:
1
2
3
4
5
6
7
8
9
10
11
| # Build using S2I
mvn oc:build
# Generate OpenShift manifests
mvn oc:resource
# Deploy to OpenShift
mvn oc:apply
# All in one
mvn clean package oc:build oc:resource oc:apply
|
Configuration for Camel Dashboard
If you want to configure Camel application before deployment for Camel Dashboard add the following label to your properties in openshift-maven-plugin
configuration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| <plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>openshift-maven-plugin</artifactId>
<version>${jkube-maven-plugin-version}</version>
<configuration>
<!-- ... -->
<resources>
<labels>
<deployment>
<property>
<name>camel.apache.org/app</name>
<value>my-camel-app</value>
</property>
</deployment>
</labels>
</resources>
<!-- ... -->
</configuration>
<!-- ... -->
</plugin>
|
If your Camel version in older than 4.12, you need to configure the business port:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| <plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>openshift-maven-plugin</artifactId>
<version>${jkube-maven-plugin-version}</version>
<configuration>
<!-- ... -->
<resources>
<annotations>
<deployment>
<property>
<name>camel.apache.org/observability-services-port</name>
<value>8080</value>
</property>
</deployment>
</annotations>
</resources>
<!-- ... -->
</configuration>
<!-- ... -->
</plugin>
|
You can add some additional non-optional configurations:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
| <plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>openshift-maven-plugin</artifactId>
<version>${jkube-maven-plugin-version}</version>
<configuration>
<!-- ... -->
<resources>
<annotations>
<deployment>
<!-- Configure custom SLI Exchange error and warning percentage -->
<property>
<name>camel.apache.org/sli-exchange-error-percentage</name>
<value>1</value>
</property>
<property>
<name>camel.apache.org/sli-exchange-warning-percentage</name>
<value>5</value>
</property>
</deployment>
</annotations>
</resources>
<!-- ... -->
</configuration>
<!-- ... -->
</plugin>
|