Kubernetes

Since Camel 2.17

The Kubernetes components integrate your application with Kubernetes standalone or on top of Openshift.

Kubernetes components

See the following for usage of each component:

Kubernetes ConfigMap

Perform operations on Kubernetes ConfigMaps and get notified on ConfigMaps changes.

Kubernetes Deployments

Perform operations on Kubernetes Deployments and get notified on Deployment changes.

Kubernetes HPA

Perform operations on Kubernetes Horizontal Pod Autoscalers (HPA) and get notified on HPA changes.

Kubernetes Job

Perform operations on Kubernetes Jobs.

Kubernetes Namespaces

Perform operations on Kubernetes Namespaces and get notified on Namespace changes.

Kubernetes Nodes

Perform operations on Kubernetes Nodes and get notified on Node changes.

Kubernetes Persistent Volume

Perform operations on Kubernetes Persistent Volumes and get notified on Persistent Volume changes.

Kubernetes Persistent Volume Claim

Perform operations on Kubernetes Persistent Volumes Claims and get notified on Persistent Volumes Claim changes.

Kubernetes Pods

Perform operations on Kubernetes Pods and get notified on Pod changes.

Kubernetes Replication Controller

Perform operations on Kubernetes Replication Controllers and get notified on Replication Controllers changes.

Kubernetes Resources Quota

Perform operations on Kubernetes Resources Quotas.

Kubernetes Secrets

Perform operations on Kubernetes Secrets.

Kubernetes Service Account

Perform operations on Kubernetes Service Accounts.

Kubernetes Services

Perform operations on Kubernetes Services and get notified on Service changes.

Openshift Build Config

Perform operations on OpenShift Build Configs.

Openshift Builds

Perform operations on OpenShift Builds.

Installation

Maven users will need to add the following dependency to their pom.xml for this component:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-kubernetes</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

Headers

Name Type Description

CamelKubernetesOperation

String

The Producer operation

CamelKubernetesNamespaceName

String

The Namespace name

CamelKubernetesNamespaceLabels

Map

The Namespace Labels

CamelKubernetesServiceLabels

Map

The Service labels

CamelKubernetesServiceName

String

The Service name

CamelKubernetesServiceSpec

io.fabric8.kubernetes.api.model.ServiceSpec

The Spec for a Service

CamelKubernetesReplicationControllersLabels

Map

Replication controller labels

CamelKubernetesReplicationControllerName

String

Replication controller name

CamelKubernetesReplicationControllerSpec

io.fabric8.kubernetes.api.model.ReplicationControllerSpec

The Spec for a Replication Controller

CamelKubernetesReplicationControllerReplicas

Integer

The number of replicas for a Replication Controller during the Scale operation

CamelKubernetesPodsLabels

Map

Pod labels

CamelKubernetesPodName

String

Pod name

CamelKubernetesPodSpec

io.fabric8.kubernetes.api.model.PodSpec

The Spec for a Pod

CamelKubernetesPersistentVolumesLabels

Map

Persistent Volume labels

CamelKubernetesPersistentVolumesName

String

Persistent Volume name

CamelKubernetesPersistentVolumesClaimsLabels

Map

Persistent Volume Claim labels

CamelKubernetesPersistentVolumesClaimsName

String

Persistent Volume Claim name

CamelKubernetesPersistentVolumesClaimsSpec

io.fabric8.kubernetes.api.model.PersistentVolumeClaimSpec

The Spec for a Persistent Volume claim

CamelKubernetesSecretsLabels

Map

Secret labels

CamelKubernetesSecretsName

String

Secret name

CamelKubernetesSecret

io.fabric8.kubernetes.api.model.Secret

A Secret Object

CamelKubernetesResourcesQuotaLabels

Map

Resource Quota labels

CamelKubernetesResourcesQuotaName

String

Resource Quota name

CamelKubernetesResourceQuotaSpec

io.fabric8.kubernetes.api.model.ResourceQuotaSpec

The Spec for a Resource Quota

CamelKubernetesServiceAccountsLabels

Map

Service Account labels

CamelKubernetesServiceAccountName

String

Service Account name

CamelKubernetesServiceAccount

io.fabric8.kubernetes.api.model.ServiceAccount

A Service Account object

CamelKubernetesNodesLabels

Map

Node labels

CamelKubernetesNodeName

String

Node name

CamelKubernetesBuildsLabels

Map

Openshift Build labels

CamelKubernetesBuildName

String

Openshift Build name

CamelKubernetesBuildConfigsLabels

Map

Openshift Build Config labels

CamelKubernetesBuildConfigName

String

Openshift Build Config name

CamelKubernetesEventAction

io.fabric8.kubernetes.client.Watcher.Action

Action watched by the consumer

CamelKubernetesEventTimestamp

String

Timestamp of the action watched by the consumer

CamelKubernetesConfigMapName

String

ConfigMap name

CamelKubernetesConfigMapsLabels

Map

ConfigMap labels

CamelKubernetesConfigData

Map

ConfigMap Data

Usage

Producer examples

Here we show some examples of producer using camel-kubernetes.

Create a pod

from("direct:createPod")
    .toF("kubernetes-pods://%s?oauthToken=%s&operation=createPod", host, authToken);

By using the KubernetesConstants.KUBERNETES_POD_SPEC header you can specify your PodSpec and pass it to this operation.

Delete a pod

from("direct:createPod")
    .toF("kubernetes-pods://%s?oauthToken=%s&operation=deletePod", host, authToken);

By using the KubernetesConstants.KUBERNETES_POD_NAME header you can specify your Pod name and pass it to this operation.

Spring Boot Auto-Configuration

When using kubernetes with Spring Boot make sure to use the following Maven dependency to have support for auto configuration:

<dependency>
  <groupId>org.apache.camel.springboot</groupId>
  <artifactId>camel-kubernetes-starter</artifactId>
  <version>x.x.x</version>
  <!-- use the same version as your Camel core version -->
</dependency>

The component supports 70 options, which are listed below.

Name Description Default Type

camel.component.kubernetes-config-maps.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-config-maps.enabled

Whether to enable auto configuration of the kubernetes-config-maps component. This is enabled by default.

Boolean

camel.component.kubernetes-config-maps.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes-deployments.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-deployments.bridge-error-handler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

Boolean

camel.component.kubernetes-deployments.enabled

Whether to enable auto configuration of the kubernetes-deployments component. This is enabled by default.

Boolean

camel.component.kubernetes-deployments.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes-hpa.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-hpa.bridge-error-handler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

Boolean

camel.component.kubernetes-hpa.enabled

Whether to enable auto configuration of the kubernetes-hpa component. This is enabled by default.

Boolean

camel.component.kubernetes-hpa.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes-job.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-job.bridge-error-handler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

Boolean

camel.component.kubernetes-job.enabled

Whether to enable auto configuration of the kubernetes-job component. This is enabled by default.

Boolean

camel.component.kubernetes-job.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes-namespaces.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-namespaces.bridge-error-handler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

Boolean

camel.component.kubernetes-namespaces.enabled

Whether to enable auto configuration of the kubernetes-namespaces component. This is enabled by default.

Boolean

camel.component.kubernetes-namespaces.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes-nodes.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-nodes.bridge-error-handler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

Boolean

camel.component.kubernetes-nodes.enabled

Whether to enable auto configuration of the kubernetes-nodes component. This is enabled by default.

Boolean

camel.component.kubernetes-nodes.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes-persistent-volumes-claims.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-persistent-volumes-claims.enabled

Whether to enable auto configuration of the kubernetes-persistent-volumes-claims component. This is enabled by default.

Boolean

camel.component.kubernetes-persistent-volumes-claims.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes-persistent-volumes.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-persistent-volumes.enabled

Whether to enable auto configuration of the kubernetes-persistent-volumes component. This is enabled by default.

Boolean

camel.component.kubernetes-persistent-volumes.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes-pods.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-pods.bridge-error-handler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

Boolean

camel.component.kubernetes-pods.enabled

Whether to enable auto configuration of the kubernetes-pods component. This is enabled by default.

Boolean

camel.component.kubernetes-pods.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes-replication-controllers.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-replication-controllers.bridge-error-handler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

Boolean

camel.component.kubernetes-replication-controllers.enabled

Whether to enable auto configuration of the kubernetes-replication-controllers component. This is enabled by default.

Boolean

camel.component.kubernetes-replication-controllers.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes-resources-quota.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-resources-quota.enabled

Whether to enable auto configuration of the kubernetes-resources-quota component. This is enabled by default.

Boolean

camel.component.kubernetes-resources-quota.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes-secrets.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-secrets.enabled

Whether to enable auto configuration of the kubernetes-secrets component. This is enabled by default.

Boolean

camel.component.kubernetes-secrets.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes-service-accounts.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-service-accounts.enabled

Whether to enable auto configuration of the kubernetes-service-accounts component. This is enabled by default.

Boolean

camel.component.kubernetes-service-accounts.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes-services.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.kubernetes-services.bridge-error-handler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

Boolean

camel.component.kubernetes-services.enabled

Whether to enable auto configuration of the kubernetes-services component. This is enabled by default.

Boolean

camel.component.kubernetes-services.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.kubernetes.cluster.service.attributes

Custom service attributes.

Map

camel.component.kubernetes.cluster.service.cluster-labels

Set the labels used to identify the pods composing the cluster.

Map

camel.component.kubernetes.cluster.service.config-map-name

Set the name of the ConfigMap used to do optimistic locking (defaults to 'leaders').

String

camel.component.kubernetes.cluster.service.connection-timeout-millis

Connection timeout in milliseconds to use when making requests to the Kubernetes API server.

Integer

camel.component.kubernetes.cluster.service.enabled

Sets if the Kubernetes cluster service should be enabled or not, default is false.

false

Boolean

camel.component.kubernetes.cluster.service.id

Cluster Service ID

String

camel.component.kubernetes.cluster.service.jitter-factor

A jitter factor to apply in order to prevent all pods to call Kubernetes APIs in the same instant.

Double

camel.component.kubernetes.cluster.service.kubernetes-namespace

Set the name of the Kubernetes namespace containing the pods and the configmap (autodetected by default)

String

camel.component.kubernetes.cluster.service.lease-duration-millis

The default duration of the lease for the current leader.

Long

camel.component.kubernetes.cluster.service.master-url

Set the URL of the Kubernetes master (read from Kubernetes client properties by default).

String

camel.component.kubernetes.cluster.service.order

Service lookup order/priority.

Integer

camel.component.kubernetes.cluster.service.pod-name

Set the name of the current pod (autodetected from container host name by default).

String

camel.component.kubernetes.cluster.service.renew-deadline-millis

The deadline after which the leader must stop its services because it may have lost the leadership.

Long

camel.component.kubernetes.cluster.service.retry-period-millis

The time between two subsequent attempts to check and acquire the leadership. It is randomized using the jitter factor.

Long

camel.component.openshift-build-configs.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.openshift-build-configs.enabled

Whether to enable auto configuration of the openshift-build-configs component. This is enabled by default.

Boolean

camel.component.openshift-build-configs.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.openshift-builds.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.openshift-builds.enabled

Whether to enable auto configuration of the openshift-builds component. This is enabled by default.

Boolean

camel.component.openshift-builds.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean