Camel CLI - Kubernetes Plugin Advanced Options
The Kubernetes Plugin page covers what most applications need. This page lists the less common settings: the trait options the plugin inherited from Camel K, running as a CronJob, Knative, and the Jolokia port.
Trait options
The Kubernetes manifest is generated by traits, a concept from Camel K. A trait option is set with --trait <trait>.<option>=<value> on camel kubernetes run and camel kubernetes export, and some of them have their own shortcut option (such as --env, --config or --volume).
A trait option can be set in several places, in this order of precedence:
-
--traitcommand options -
Annotations with prefix
trait.camel.apache.org/*(--annotation) -
Properties in
application-<profile>.propertieswith prefixcamel.jbang.trait.* -
Properties in
application.propertieswith prefixcamel.jbang.trait.*
Setting them in application.properties keeps them with the project, so every run and export uses them:
camel.jbang.trait.container.request-memory=256Mi
camel.jbang.trait.service.type=LoadBalancer Container trait
Customize the container specification (image, ports, resources):
| Property | Type | Description |
|---|---|---|
|
| To configure a different port exposed by the container (default |
|
| To configure a different port name for the port exposed by the container. It defaults to |
|
| To configure under which service port the container port is to be exposed (default |
|
| To configure under which service port name the container port is to be exposed (default |
|
| The application container name. |
|
| The application container image to use for the Deployment. |
|
| The pull policy: Always|Never|IfNotPresent |
|
| The pull secrets for private registries |
|
| The minimum amount of CPU required. |
|
| The minimum amount of memory required. |
|
| The maximum amount of CPU required. |
|
| The maximum amount of memory required. |
Example:
camel kubernetes export Sample.java --trait container.name=my-container --trait container.port=8088 --trait container.request-cpu=0.005 --trait container.request-memory=100Mi CronJob trait (run as a scheduled job)
Generate a CronJob instead of a Deployment (requires enabled=true and schedule):
camel kubernetes export Sample.java --trait=cronjob.enabled=true --trait=cronjob.schedule="* * * * 2" | Property | Type | Description |
|---|---|---|
|
| To generate the CronJob manifest instead of Deployment. (default=false) |
|
| To set the schedule to run the workload following the crontab format. |
|
| To set the timezone to run the workload. |
|
| To set the |
|
| To set the |
|
| To set the |
|
| To set the |
Service trait
A Service resource is auto-generated when routes expose HTTP endpoints (e.g., platform-http). Customize it:
| Property | Type | Description |
|---|---|---|
|
| The type of service to be used, either 'ClusterIP', 'NodePort' or 'LoadBalancer'. |
|
| To configure under which service port the container port is to be exposed (default |
|
| To configure under which service port name the container port is to be exposed (default |
Ingress trait
Add an Ingress resource to expose the application externally (requires a Service resource):
| Property | Type | Description |
|---|---|---|
|
| Can be used to enable or disable a trait. All traits share this common property (default |
|
| The annotations added to the ingress. This can be used to set controller-specific annotations, e.g., when using the NGINX Ingress controller. |
|
| To configure the host exposed by the ingress. |
|
| To configure the path exposed by the ingress (default |
|
| To configure the path type exposed by the ingress. One of Exact, Prefix, ImplementationSpecific (default to Prefix). |
|
| To automatically add an Ingress Resource whenever the route uses an HTTP endpoint consumer (default |
|
| To configure specific hosts exposed through SNI TLS extension by the ingess. |
|
| To indicate the secret containing the TLS private key and certificate to use for TLS. |
Example:
camel kubernetes export Sample.java --trait ingress.enabled=true --trait ingress.host=example.com --trait ingress.path=/sample Route trait (OpenShift)
Add an OpenShift Route resource to expose the application externally:
| Property | Type | Description |
|---|---|---|
|
| Can be used to enable or disable a trait. All traits share this common property (default |
|
| The annotations added to the route. This can be used to set openshift route specific annotations options. |
|
| To configure the host exposed by the route. |
|
| The TLS termination type, like |
|
| The TLS certificate contents or file ( |
|
| The TLS certificate key contents or file ( |
|
| The TLS CA certificate contents or file ( |
|
| The destination CA contents or file ( |
|
| To configure how to deal with insecure traffic, e.g. |
Example:
camel kubernetes export Sample.java --cluster-type=openshift --trait route.enabled=true --trait route.host=example.com --trait route.tls-termination=edge Jolokia trait
Enable JMX access via Jolokia (requires Jolokia configured in the application):
| Property | Type | Description |
|---|---|---|
|
| Can be used to enable or disable a trait. All traits share this common property. (default |
|
| To configure a different jolokia port exposed by the container (default |
|
| To configure a different port name for the port exposed by the container (default |
|
| Can be used to enable/disable exposure of jolokia via kubernetes Service. (default |
|
| To configure a different jolokia port exposed by the service (default |
|
| To configure a different port name for the port exposed by the service (default |
Example:
camel kubernetes export Sample.java --trait jolokia.enabled=true --trait jolokia.expose=true Mount trait
Configure volume mounts from ConfigMaps, Secrets, and PVCs. Shortcuts: --volume, --config, --resource.
| Property | Type | Description |
|---|---|---|
|
| A list of configuration pointing to configmap/secret. The configurations are expected to be UTF-8 resources as they are processed by runtime Camel Context and tried to be parsed as property files. They are also made available on the classpath to ease their usage directly from the Route. Syntax: [configmap|secret]:name[/key], where name represents the resource name and key optionally represents the resource key to be filtered |
|
| A list of resources (text or binary content) pointing to a configmap/secret. The resources are expected to be any resource type (text or binary content). The destination path can be either a default location or any path specified by the user. Syntax: [configmap|secret]:name[/key][@path], where name represents the resource name, key optionally represents the resource key to be filtered and path represents the destination path |
|
| A list of Persistent Volume Claims to be mounted. Syntax: [pvcname:/container/path] |
Example:
camel kubernetes export Sample.java --config secret:my-credentials --resource configmap:my-data --volume my-pvc:/container/path Mount paths follow Camel conventions: configs go to /etc/camel/conf.d/, resources to /etc/camel/resources.d/, and the application is auto-configured to read these paths.
Knative
Knative runs the application as a serverless service (Knative serving) and connects it to event brokers and channels (Knative eventing). The plugin generates the Knative resources for the Knative component used in the routes.
Knative service trait
Use Knative serving for serverless workloads with auto-scaling and scale-to-zero.
Disabled by default — enable with --trait knative-service.enabled=true. |
| Property | Type | Description |
|---|---|---|
|
| Can be used to enable or disable a trait. All traits share this common property. |
|
| The annotations added to route. This can be used to set knative service-specific annotations CLI usage example: -t "knative-service.annotations.'haproxy.router.openshift.io/balance'=true" |
|
| Configures the Knative autoscaling class property (e.g., to set Refer to the Knative documentation for more information. |
|
| Configures the Knative autoscaling metric property (e.g., to set Refer to the Knative documentation for more information. |
|
| Sets the allowed concurrency level or CPU percentage (depending on the autoscaling metric) for each Pod. Refer to the Knative documentation for more information. |
|
| The minimum number of Pods that should be running at any time for the integration. It’s zero by default, meaning that the integration is scaled down to zero when not used for a configured amount of time. Refer to the Knative documentation for more information. |
|
| An upper bound for the number of Pods that can be running in parallel for the integration. Knative has its own cap value that depends on the installation. Refer to the Knative documentation for more information. |
|
| Enables to gradually shift traffic to the latest Revision and sets the rollout duration. It’s disabled by default and must be expressed as a Golang |
|
| Setting Refer to the Knative documentation for more information. |
|
| The maximum duration in seconds that the request instance is allowed to respond to a request. This field propagates to the integration Pod’s terminationGracePeriodSeconds. Refer to the Knative documentation for more information. |
Knative component trait
Configure the Camel Knative component to interact with Knative eventing and Knative serving. The export auto-configures both the component and the Kubernetes manifest.
Disabled by default — enable with --trait knative.enabled=true. |
| Property | Type | Description |
|---|---|---|
|
| Can be used to enable or disable a trait. (default: true) |
|
| Can be used to inject a Knative complete configuration in JSON format |
|
| List of channels used as destination of camel routes. Can contain simple channel names or full Camel URIs. Refer to the Knative documentation for more information. |
|
| List of channels used as the source of camel routes. Can contain simple channel names or full Camel URIs. |
|
| List of endpoints used as destination of camel routes. Can contain simple endpoint names or full Camel URIs. |
|
| List of endpoints used as sources of camel routes. Can contain simple endpoint names or full Camel URIs. |
|
| List of endpoints used as destination of integration routes. Can contain simple endpoint names or full Camel URIs. |
|
| List of event types that the integration will be subscribed to. Can contain simple event types or full Camel URIs (to use a specific broker different from "default"). |
|
| Allows binding the integration to a sink via a Knative SinkBinding resource. This can be used when the integration targets a single sink. It’s enabled by default when the integration targets a single sink (except when the integration is owned by a Knative source). |
|
| Sets filter attributes on the event stream (such as event type, source, subject and so on). A list of key-value pairs that represent filter attributes and its values. The syntax is KEY=VALUE, e.g., source="my.source". Filter attributes get set on the Knative trigger that is being created as part of this integration. |
|
| Enables the default filtering for the Knative trigger using the event type If this is true, the created Knative trigger uses the event type as a filter on the event stream when no other filter criteria is given. (default: true) |
Knative trigger
When a route consumes from knative:event, the plugin automatically generates a Knative Trigger in the manifest:
- route:
from:
uri: knative:event/camel.evt.type
parameters:
name: my-broker
steps:
- to:
uri: log:info Export with camel kubernetes export knative-route.yaml — the trigger, service, and knative.json configuration are all generated automatically.