blob: 72c8c091431929925356aeec6c9c1f2d3d2db4cf [file] [log] [blame]
[[kubernetes-component]]
== Kubernetes Component (deprecated)
*Available as of Camel version 2.17*
[IMPORTANT]
====================================================================================
The composite kubernetes component has been deprecated. Use individual
component splitted as following.
* <<kubernetes-component,Kubernetes Components>>
** <<openshift-build-configs-component,Kubernetes Build Config>>
** Kubernetes Build
** <<kubernetes-config-maps-component,Kubernetes ConfigMap>>
** <<kubernetes-namespaces-component,Kubernetes Namespace>>
** <<kubernetes-nodes-component,Kubernetes Node>>
** <<kubernetes-persistent-volumes-component,Kubernetes Persistent Volume>>
** <<kubernetes-persistent-volumes-claims-component,Kubernetes Persistent Volume Claim>>
** <<kubernetes-pods-component,Kubernetes Pod>>
** <<kubernetes-replication-controllers-component,Kubernetes Replication Controller>>
** <<kubernetes-resources-quota-component,Kubernetes Resource Quota>>
** <<kubernetes-secrets-component,Kubernetes Secrets>>
** <<kubernetes-service-accounts-component,Kubernetes Service Account>>
** <<kubernetes-services-component,Kubernetes Service>>
====================================================================================
The *Kubernetescomponent is a component for integrating your
application with Kubernetes standalone or on top of Openshift
Maven users will need to add the following dependency to
their `pom.xml` for this component:
[source,xml]
------------------------------------------------------------
<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>
------------------------------------------------------------
=== URI format
[source,java]
------------------------------
kubernetes:masterUrl[?options]
------------------------------
You can append query options to the URI in the following
format`?option=value&option=value&...`
=== Options
// component options: START
The Kubernetes component has no options.
// component options: END
// endpoint options: START
The Kubernetes endpoint is configured using URI syntax:
----
kubernetes:masterUrl
----
with the following path and query parameters:
==== Path Parameters (1 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
| *masterUrl* | *Required* Kubernetes Master url | | String
|===
==== Query Parameters (28 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
| *apiVersion* (common) | The Kubernetes API Version to use | | String
| *category* (common) | *Required* Kubernetes Producer and Consumer category | | String
| *dnsDomain* (common) | The dns domain, used for ServiceCall EIP | | String
| *kubernetesClient* (common) | Default KubernetesClient to use if provided | | KubernetesClient
| *portName* (common) | The port name, used for ServiceCall EIP | | String
| *bridgeErrorHandler* (consumer) | 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
| *labelKey* (consumer) | The Consumer Label key when watching at some resources | | String
| *labelValue* (consumer) | The Consumer Label value when watching at some resources | | String
| *namespace* (consumer) | The namespace | | String
| *poolSize* (consumer) | The Consumer pool size | 1 | int
| *resourceName* (consumer) | The Consumer Resource Name we would like to watch | | String
| *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler
| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern
| *operation* (producer) | Producer operation to do on Kubernetes | | String
| *connectionTimeout* (advanced) | Connection timeout in milliseconds to use when making requests to the Kubernetes API server. | | Integer
| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
| *caCertData* (security) | The CA Cert Data | | String
| *caCertFile* (security) | The CA Cert File | | String
| *clientCertData* (security) | The Client Cert Data | | String
| *clientCertFile* (security) | The Client Cert File | | String
| *clientKeyAlgo* (security) | The Key Algorithm used by the client | | String
| *clientKeyData* (security) | The Client Key data | | String
| *clientKeyFile* (security) | The Client Key file | | String
| *clientKeyPassphrase* (security) | The Client Key Passphrase | | String
| *oauthToken* (security) | The Auth Token | | String
| *password* (security) | Password to connect to Kubernetes | | String
| *trustCerts* (security) | Define if the certs we used are trusted anyway or not | | Boolean
| *username* (security) | Username to connect to Kubernetes | | String
|===
// endpoint options: END
=== Headers
[width="100%",cols="10%,10%,80%",options="header",]
|=======================================================================
|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
|=======================================================================
=== Categories
Actually the camel-kubernetes component supports the following Kubernetes resources
- Namespaces
- Pods
- Replication Controllers
- Services
- Persistent Volumes
- Persistent Volume Claims
- Secrets
- Resource Quota
- Service Accounts
- Nodes
- Configmaps
In Openshift also
- Builds
- BuildConfigs
=== Usage
==== Producer examples
Here we show some examples of producer using camel-kubernetes.
==== Create a pod
[source,java]
-------------------------------------------------------------
from("direct:createPod")
.toF("kubernetes://%s?oauthToken=%s&category=pods&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
[source,java]
-------------------------------------------------------------
from("direct:createPod")
.toF("kubernetes://%s?oauthToken=%s&category=pods&operation=deletePod", host, authToken);
-------------------------------------------------------------
By using the KubernetesConstants.KUBERNETES_POD_NAME header you can specify your Pod name and pass it to this operation.