Kubernetes
JVM since1.0.0 Native since1.0.0
Perform operations against Kubernetes API
What’s inside
-
Kubernetes ConfigMap component, URI syntax:
kubernetes-config-maps:masterUrl
-
Kubernetes Cronjob component, URI syntax:
kubernetes-cronjob:masterUrl
-
Kubernetes Custom Resources component, URI syntax:
kubernetes-custom-resources:masterUrl
-
Kubernetes Deployments component, URI syntax:
kubernetes-deployments:masterUrl
-
Kubernetes Event component, URI syntax:
kubernetes-events:masterUrl
-
Kubernetes HPA component, URI syntax:
kubernetes-hpa:masterUrl
-
Kubernetes Job component, URI syntax:
kubernetes-job:masterUrl
-
Kubernetes Namespaces component, URI syntax:
kubernetes-namespaces:masterUrl
-
Kubernetes Nodes component, URI syntax:
kubernetes-nodes:masterUrl
-
Kubernetes Persistent Volume component, URI syntax:
kubernetes-persistent-volumes:masterUrl
-
Kubernetes Persistent Volume Claim component, URI syntax:
kubernetes-persistent-volumes-claims:masterUrl
-
Kubernetes Pods component, URI syntax:
kubernetes-pods:masterUrl
-
Kubernetes Replication Controller component, URI syntax:
kubernetes-replication-controllers:masterUrl
-
Kubernetes Resources Quota component, URI syntax:
kubernetes-resources-quota:masterUrl
-
Kubernetes Secrets component, URI syntax:
kubernetes-secrets:masterUrl
-
Kubernetes Service Account component, URI syntax:
kubernetes-service-accounts:masterUrl
-
Kubernetes Services component, URI syntax:
kubernetes-services:masterUrl
-
OpenShift Build Config component, URI syntax:
openshift-build-configs:masterUrl
-
OpenShift Builds component, URI syntax:
openshift-builds:masterUrl
-
OpenShift Deployment Configs component, URI syntax:
openshift-deploymentconfigs:masterUrl
Please refer to the above links for usage and configuration details.
Maven coordinates
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-kubernetes</artifactId>
</dependency>
Check the User guide for more information about writing Camel Quarkus applications.
Additional Camel Quarkus configuration
Automatic registration of a Kubernetes Client instance
The extension automatically registers a Kubernetes Client bean named kubernetesClient
. You can reference the bean in your routes like this:
from("direct:pods")
.to("kubernetes-pods:///?kubernetesClient=#kubernetesClient&operation=listPods")
Or you can omit referring to the client bean entirely and the Kubernetes component will automatically use the Kubernetes client that was autowired.
from("direct:pods")
.to("kubernetes-pods:local?operation=listPods")
By default, the client is configured from the local kubeconfig file. You can customize the client configuration via properties within application.properties
:
quarkus.kubernetes-client.master-url=https://my.k8s.host
quarkus.kubernetes-client.namespace=my-namespace
The full set of configuration options are documented in the Quarkus Kubernetes Client guide.
If you want to suppress this behavior, you can disable autowiring and all configuration will be driven from the documented component and endpoint options.
To disable autowiring at the component level, add the following configuration to application.properties
.
camel.component.kubernetes-pods.autowired-enabled=false
To disable autowiring at the endpoint level.
from("direct:pods")
.to("kubernetes-pods:https://my.cluster.host?autowiredEnabled=false&operation=listPods")
OpenShift specific components
When using any of the OpenShift specific components:
-
openenshift-build-configs
-
openenshift-builds
-
openshift-deploymentconfigs
You must add the following dependency to your application.
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-openshift-client</artifactId>
</dependency>
Having only a single consumer in a cluster consuming from a given endpoint
This functionality is provided by the camel-quarkus-kubernetes-cluster-service
extension. Refer to the extension documentation for more information.