Chapter 6. Camel K trait configuration reference This chapter provides reference information about advanced features and core capabilities that you can configure on the command line at runtime using traits . Camel K provides feature traits to configure specific features and technologies. Camel K provides platform traits to configure internal Camel K core capabilities. Important The Red Hat Integration - Camel K 1.6 includes the OpenShift and Knative profiles. The Kubernetes profile has community-only support. It also includes Java, and YAML DSL support for integrations. Other languages such as XML, Groovy, JavaScript, and Kotlin have community-only support. This chapter includes the following sections: Camel K feature traits Section 6.2.1, "Knative Trait" - Technology Preview Section 6.2.2, "Knative Service Trait" - Technology Preview Section 6.2.3, "Prometheus Trait" Section 6.2.4, "Pdb Trait" Section 6.2.5, "Pull Secret Trait" Section 6.2.6, "Route Trait" Section 6.2.7, "Service Trait" Camel K core platform traits Section 6.3.1, "Builder Trait" Section 6.3.3, "Camel Trait" Section 6.3.2, "Container Trait" Section 6.3.4, "Dependencies Trait" Section 6.3.5, "Deployer Trait" Section 6.3.6, "Deployment Trait" Section 6.3.7, "Environment Trait" Section 6.3.8, "Error Handler Trait" Section 6.3.9, "Jvm Trait" Section 6.3.10, "Kamelets Trait" Section 6.3.11, "NodeAffinity Trait" Section 6.3.12, "Openapi Trait" - Technology Preview Section 6.3.13, "Owner Trait" Section 6.3.14, "Platform Trait" Section 6.3.15, "Quarkus Trait" 6.1. Camel K trait and profile configuration This section explains the important Camel K concepts of traits and profiles , which are used to configure advanced Camel K features at runtime. Camel K traits Camel K traits are advanced features and core capabilities that you can configure on the command line to customize Camel K integrations. For example, this includes feature traits that configure interactions with technologies such as 3scale API Management, Quarkus, Knative, and Prometheus. Camel K also provides internal platform traits that configure important core platform capabilities such as Camel support, containers, dependency resolution, and JVM support. Camel K profiles Camel K profiles define the target cloud platforms on which Camel K integrations run. Supported profiles are OpenShift and Knative profiles. Note When you run an integration on OpenShift, Camel K uses the Knative profile when OpenShift Serverless is installed on the cluster. Camel K uses the OpenShift profile when OpenShift Serverless is not installed. You can also specify the profile at runtime using the kamel run --profile option. Camel K provides useful defaults for all traits, taking into account the target profile on which the integration runs. However, advanced users can configure Camel K traits for custom behavior. Some traits only apply to specific profiles such as OpenShift or Knative . For more details, see the available profiles in each trait description. Camel K trait configuration Each Camel trait has a unique ID that you can use to configure the trait on the command line. For example, the following command disables creating an OpenShift Service for an integration: kamel run --trait service.enabled=false my-integration.yaml You can also use the -t option to specify traits. Camel K trait properties You can use the enabled property to enable or disable each trait. All traits have their own internal logic to determine if they need to be enabled when the user does not activate them explicitly. Warning Disabling a platform trait may compromise the platform functionality. Some traits have an auto property, which you can use to enable or disable automatic configuration of the trait based on the environment. For example, this includes traits such as 3scale, Cron, and Knative. This automatic configuration can enable or disable the trait when the enabled property is not explicitly set, and can change the trait configuration. Most traits have additional properties that you can configure on the command line. For more details, see the descriptions for each trait in the sections that follow. 6.2. Camel K feature traits 6.2.1. Knative Trait The Knative trait automatically discovers addresses of Knative resources and inject them into the running integration. The full Knative configuration is injected in the CAMEL_KNATIVE_CONFIGURATION in JSON format. The Camel Knative component will then use the full configuration to configure the routes. The trait is enabled by default when the Knative profile is active. This trait is available in the following profiles: Knative . 6.2.1.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait knative.[key]=[value] --trait knative.[key2]=[value2] integration.java The following configuration options are available: Property Type Description knative.enabled bool Can be used to enable or disable a trait. All traits share this common property. knative.configuration string Can be used to inject a Knative complete configuration in JSON format. knative.channel-sources []string List of channels used as source of integration routes. Can contain simple channel names or full Camel URIs. knative.channel-sinks []string List of channels used as destination of integration routes. Can contain simple channel names or full Camel URIs. knative.endpoint-sources []string List of channels used as source of integration routes. knative.endpoint-sinks []string List of endpoints used as destination of integration routes. Can contain simple endpoint names or full Camel URIs. knative.event-sources []string 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"). knative.event-sinks []string List of event types that the integration will produce. Can contain simple event types or full Camel URIs (to use a specific broker). knative.filter-source-channels bool Enables filtering on events based on the header "ce-knativehistory". Since this header has been removed in newer versions of Knative, filtering is disabled by default. knative.sink-binding bool 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). knative.auto bool Enable automatic discovery of all trait properties. 6.2.2. Knative Service Trait The Knative Service trait allows to configure options when running the integration as Knative service instead of a standard Kubernetes Deployment. Running integrations as Knative Services adds auto-scaling (and scaling-to-zero) features, but those features are only meaningful when the routes use a HTTP endpoint consumer. This trait is available in the following profiles: Knative . 6.2.2.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait knative-service.[key]=[value] --trait knative-service.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description knative-service.enabled bool Can be used to enable or disable a trait. All traits share this common property. knative-service.annotations map[string]string The annotations are added to route. This can be used to set knative service specific annotations. For more details see, Route Specific Annotations . CLI usage example: -t "knative-service.annotations.'haproxy.router.openshift.io/balance'=roundrobin" knative-service.autoscaling-class string Configures the Knative autoscaling class property (e.g. to set hpa.autoscaling.knative.dev or kpa.autoscaling.knative.dev autoscaling). Refer to the Knative documentation for more information. knative-service.autoscaling-metric string Configures the Knative autoscaling metric property (e.g. to set concurrency based or cpu based autoscaling). Refer to the Knative documentation for more information. knative-service.autoscaling-target int Sets the allowed concurrency level or CPU percentage (depending on the autoscaling metric) for each Pod. Refer to the Knative documentation for more information. knative-service.min-scale int 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. knative-service.max-scale int 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. knative-service.auto bool Automatically deploy the integration as Knative service when all conditions hold: Integration is using the Knative profile All routes are either starting from a HTTP based consumer or a passive consumer (e.g. direct is a passive consumer) 6.2.3. Prometheus Trait The Prometheus trait configures a Prometheus-compatible endpoint. It also creates a PodMonitor resource, so that the endpoint can be scraped automatically, when using the Prometheus operator. The metrics are exposed using MicroProfile Metrics. Warning The creation of the PodMonitor resource requires the Prometheus Operator custom resource definition to be installed. You can set pod-monitor to false for the Prometheus trait to work without the Prometheus Operator. The Prometheus trait is disabled by default. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . 6.2.3.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait prometheus.[key]=[value] --trait prometheus.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description prometheus.enabled bool Can be used to enable or disable a trait. All traits share this common property. prometheus.pod-monitor bool Whether a PodMonitor resource is created (default true ). prometheus.pod-monitor-labels []string The PodMonitor resource labels, applicable when pod-monitor is true . 6.2.4. Pdb Trait The PDB trait allows to configure the PodDisruptionBudget resource for the Integration pods. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . 6.2.4.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait pdb.[key]=[value] --trait pdb.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description pdb.enabled bool Can be used to enable or disable a trait. All traits share this common property. pdb.min-available string The number of pods for the Integration that must still be available after an eviction. It can be either an absolute number or a percentage. Only one of min-available and max-unavailable can be specified. pdb.max-unavailable string The number of pods for the Integration that can be unavailable after an eviction. It can be either an absolute number or a percentage (default 1 if min-available is also not set). Only one of max-unavailable and min-available can be specified. 6.2.5. Pull Secret Trait The Pull Secret trait sets a pull secret on the pod, to allow Kubernetes to retrieve the container image from an external registry. The pull secret can be specified manually or, in case you've configured authentication for an external container registry on the IntegrationPlatform , the same secret is used to pull images. It's enabled by default whenever you configure authentication for an external container registry, so it assumes that external registries are private. If your registry does not need authentication for pulling images, you can disable this trait. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . 6.2.5.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait pull-secret.[key]=[value] --trait pull-secret.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description pull-secret.enabled bool Can be used to enable or disable a trait. All traits share this common property. pull-secret.secret-name string The pull secret name to set on the Pod. If left empty this is automatically taken from the IntegrationPlatform registry configuration. pull-secret.image-puller-delegation bool When using a global operator with a shared platform, this enables delegation of the system:image-puller cluster role on the operator namespace to the integration service account. pull-secret.auto bool Automatically configures the platform registry secret on the pod if it is of type kubernetes.io/dockerconfigjson . 6.2.6. Route Trait The Route trait can be used to configure the creation of OpenShift routes for the integration. The certificate and key contents may be sourced either from the local filesystem or in a Openshift secret object. The user may use the parameters ending in -secret (example: tls-certificate-secret ) to reference a certificate stored in a secret . Parameters ending in -secret have higher priorities and in case the same route parameter is set, for example: tls-key-secret and tls-key , then tls-key-secret is used. The recommended approach to set the key and certificates is to use secrets to store their contents and use the following parameters to reference them: tls-certificate-secret , tls-key-secret , tls-ca-certificate-secret , tls-destination-ca-certificate-secret See the examples section at the end of this page to see the setup options. This trait is available in the following profiles: OpenShift . 6.2.6.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait route.[key]=[value] --trait route.[key2]=[value2] integration.java The following configuration options are available: Property Type Description route.enabled bool Can be used to enable or disable a trait. All traits share this common property. route.annotations map[string]string The annotations are added to route. This can be used to set route specific annotations. For annotations options see Route Specific Annotations . CLI usage example: -t "route.annotations.'haproxy.router.openshift.io/balance'=roundrobin route.host string To configure the host exposed by the route. route.tls-termination string The TLS termination type, like edge , passthrough or reencrypt . Refer to the OpenShift route documentation for additional information. route.tls-certificate string The TLS certificate contents. Refer to the OpenShift route documentation for additional information. route.tls-certificate-secret string The secret name and key reference to the TLS certificate. The format is "secret-name[/key-name]", the value represents the secret name, if there is only one key in the secret it will be read, otherwise you can set a key name separated with a "/". Refer to the OpenShift route documentation for additional information. route.tls-key string The TLS certificate key contents. Refer to the OpenShift route documentation for additional information. route.tls-key-secret string The secret name and key reference to the TLS certificate key. The format is "secret-name[/key-name]", the value represents the secret name, if there is only one key in the secret it will be read, otherwise you can set a key name separated with a "/". Refer to the OpenShift route documentation for additional information. route.tls-ca-certificate string The TLS CA certificate contents. Refer to the OpenShift route documentation for additional information. route.tls-ca-certificate-secret string The secret name and key reference to the TLS CA certificate. The format is "secret-name[/key-name]", the value represents the secret name, if there is only one key in the secret it will be read, otherwise you can set a key name separated with a "/". Refer to the OpenShift route documentation for additional information. route.tls-destination-ca-certificate string The destination CA certificate provides the contents of the ca certificate of the final destination. When using reencrypt termination this file should be provided in order to have routers use it for health checks on the secure connection. If this field is not specified, the router may provide its own destination CA and perform hostname validation using the short service name (service.namespace.svc), which allows infrastructure generated certificates to automatically verify. Refer to the OpenShift route documentation for additional information. route.tls-destination-ca-certificate-secret string The secret name and key reference to the destination CA certificate. The format is "secret-name[/key-name]", the value represents the secret name, if there is only one key in the secret it will be read, otherwise you can set a key name separated with a "/". Refer to the OpenShift route documentation for additional information. route.tls-insecure-edge-termination-policy string To configure how to deal with insecure traffic, e.g. Allow , Disable or Redirect traffic. Refer to the OpenShift route documentation for additional information. 6.2.6.2. Examples These examples uses secrets to store the certificates and keys to be referenced in the integrations. Read Openshift route documentation for detailed information about routes. The PlatformHttpServer.java is the integration example. As a requirement to run these examples, you should have a secret with a key and certificate. 6.2.6.2.1. Generate a self-signed certificate and create a secret openssl genrsa -out tls.key openssl req -new -key tls.key -out csr.csr -subj "/CN=my-server.com" openssl x509 -req -in csr.csr -signkey tls.key -out tls.crt oc create secret tls my-combined-certs --key=tls.key --cert=tls.crt 6.2.6.2.2. Making an HTTP request to the route For all examples, you can use the following curl command to make an HTTP request. It makes use of inline scripts to retrieve the openshift namespace and cluster base domain, if you are using a shell which doesn't support these inline scripts, you should replace the inline scripts with the values of your actual namespace and base domain. curl -k https://platform-http-server-`oc config view --minify -o 'jsonpath={..namespace}'`.`oc get dnses/cluster -ojsonpath='{.spec.baseDomain}'`/hello?name=Camel-K To add an edge route using secrets, use the parameters ending in -secret to set the secret name which contains the certificate. This route example trait references a secret named my-combined-certs which contains two keys named tls.key and tls.crt . kamel run --dev PlatformHttpServer.java -t route.tls-termination=edge -t route.tls-certificate-secret=my-combined-certs/tls.crt -t route.tls-key-secret=my-combined-certs/tls.key To add a passthrough route using secrets, the TLS is setup in the integration pod, the keys and certificates should be visible in the running integration pod, to achieve this we are using the --resource kamel parameter to mount the secret in the integration pod, then we use some camel quarkus parameters to reference these certificate files in the running pod, they start with -p quarkus.http.ssl.certificate . This route example trait references a secret named my-combined-certs which contains two keys named tls.key and tls.crt . kamel run --dev PlatformHttpServer.java --resource secret:my-combined-certs@/etc/ssl/my-combined-certs -p quarkus.http.ssl.certificate.file=/etc/ssl/my-combined-certs/tls.crt -p quarkus.http.ssl.certificate.key-file=/etc/ssl/my-combined-certs/tls.key -t route.tls-termination=passthrough -t container.port=8443 To add a reencrypt route using secrets, the TLS is setup in the integration pod, the keys and certificates should be visible in the running integration pod, to achieve this we are using the --resource kamel parameter to mount the secret in the integration pod, then we use some camel quarkus parameters to reference these certificate files in the running pod, they start with -p quarkus.http.ssl.certificate . This route example trait references a secret named my-combined-certs which contains two keys named tls.key and tls.crt . kamel run --dev PlatformHttpServer.java --resource secret:my-combined-certs@/etc/ssl/my-combined-certs -p quarkus.http.ssl.certificate.file=/etc/ssl/my-combined-certs/tls.crt -p quarkus.http.ssl.certificate.key-file=/etc/ssl/my-combined-certs/tls.key -t route.tls-termination=reencrypt -t route.tls-destination-ca-certificate-secret=my-combined-certs/tls.crt -t route.tls-certificate-secret=my-combined-certs/tls.crt -t route.tls-key-secret=my-combined-certs/tls.key -t container.port=8443 To add a reencrypt route using a specific certificate from a secret for the route and Openshift service serving certificates for the integration endpoint. This way the Openshift service serving certificates is set up only in the integration pod. The keys and certificates should be visible in the running integration pod, to achieve this we are using the --resource kamel parameter to mount the secret in the integration pod, then we use some camel quarkus parameters to reference these certificate files in the running pod, they start with -p quarkus.http.ssl.certificate . This route example trait references a secret named my-combined-certs which contains two keys named tls.key and tls.crt . kamel run --dev PlatformHttpServer.java --resource secret:cert-from-openshift@/etc/ssl/cert-from-openshift -p quarkus.http.ssl.certificate.file=/etc/ssl/cert-from-openshift/tls.crt -p quarkus.http.ssl.certificate.key-file=/etc/ssl/cert-from-openshift/tls.key -t route.tls-termination=reencrypt -t route.tls-certificate-secret=my-combined-certs/tls.crt -t route.tls-key-secret=my-combined-certs/tls.key -t container.port=8443 Then you should annotate the integration service to inject the Openshift service serving certificates oc annotate service platform-http-server service.beta.openshift.io/serving-cert-secret-name=cert-from-openshift To add an edge route using a certificate and a private key provided from your local filesystem. This example uses inline scripts to read the certificate and private key file contents, then remove all new line characters, (this is required to set the certificate as parameter's values), so the values are in a single line. kamel run PlatformHttpServer.java --dev -t route.tls-termination=edge -t route.tls-certificate="USD(cat tls.crt|awk 'NF {sub(/\r/, ""); printf "%s\\n",USD0;}')" -t route.tls-key="USD(cat tls.key|awk 'NF {sub(/\r/, ""); printf "%s\\n",USD0;}')" 6.2.7. Service Trait The Service trait exposes the integration with a Service resource so that it can be accessed by other applications (or integrations) in the same namespace. It's enabled by default if the integration depends on a Camel component that can expose a HTTP endpoint. This trait is available in the following profiles: Kubernetes, OpenShift . 6.2.7.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait service.[key]=[value] --trait service.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description service.enabled bool Can be used to enable or disable a trait. All traits share this common property. service.auto bool To automatically detect from the code if a Service needs to be created. service.node-port bool Enable Service to be exposed as NodePort (default false ). 6.3. Camel K platform traits 6.3.1. Builder Trait The builder trait is internally used to determine the best strategy to build and configure IntegrationKits. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The builder trait is a platform trait : disabling it may compromise the platform functionality. 6.3.1.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait builder.[key]=[value] --trait builder.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description builder.enabled bool Can be used to enable or disable a trait. All traits share this common property. builder.verbose bool Enable verbose logging on build components that support it (e.g., OpenShift build pod). Kaniko and Buildah are not supported. builder.properties []string A list of properties to be provided to the build task 6.3.2. Container Trait The Container trait can be used to configure properties of the container where the integration will run. It also provides configuration for Services associated to the container. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The container trait is a platform trait : disabling it may compromise the platform functionality. 6.3.2.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait container.[key]=[value] --trait container.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description container.enabled bool Can be used to enable or disable a trait. All traits share this common property. container.auto bool container.request-cpu string The minimum amount of CPU required. container.request-memory string The minimum amount of memory required. container.limit-cpu string The maximum amount of CPU required. container.limit-memory string The maximum amount of memory required. container.expose bool Can be used to enable/disable exposure via kubernetes Service. container.port int To configure a different port exposed by the container (default 8080 ). container.port-name string To configure a different port name for the port exposed by the container (default http ). container.service-port int To configure under which service port the container port is to be exposed (default 80 ). container.service-port-name string To configure under which service port name the container port is to be exposed (default http ). container.name string The main container name. It's named integration by default. container.image string The main container image container.probes-enabled bool ProbesEnabled enable/disable probes on the container (default false ) container.liveness-initial-delay int32 Number of seconds after the container has started before liveness probes are initiated. container.liveness-timeout int32 Number of seconds after which the probe times out. Applies to the liveness probe. container.liveness-period int32 How often to perform the probe. Applies to the liveness probe. container.liveness-success-threshold int32 Minimum consecutive successes for the probe to be considered successful after having failed. Applies to the liveness probe. container.liveness-failure-threshold int32 Minimum consecutive failures for the probe to be considered failed after having succeeded. Applies to the liveness probe. container.readiness-initial-delay int32 Number of seconds after the container has started before readiness probes are initiated. container.readiness-timeout int32 Number of seconds after which the probe times out. Applies to the readiness probe. container.readiness-period int32 How often to perform the probe. Applies to the readiness probe. container.readiness-success-threshold int32 Minimum consecutive successes for the probe to be considered successful after having failed. Applies to the readiness probe. container.readiness-failure-threshold int32 Minimum consecutive failures for the probe to be considered failed after having succeeded. Applies to the readiness probe. 6.3.3. Camel Trait The Camel trait can be used to configure versions of Apache Camel K runtime and related libraries, it cannot be disabled. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The camel trait is a platform trait : disabling it may compromise the platform functionality. 6.3.3.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait camel.[key]=[value] --trait camel.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description camel.enabled bool Can be used to enable or disable a trait. All traits share this common property. 6.3.4. Dependencies Trait The Dependencies trait is internally used to automatically add runtime dependencies based on the integration that the user wants to run. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The dependencies trait is a platform trait : disabling it may compromise the platform functionality. 6.3.4.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait dependencies.[key]=[value] Integration.java The following configuration options are available: Property Type Description dependencies.enabled bool Can be used to enable or disable a trait. All traits share this common property. 6.3.5. Deployer Trait The deployer trait can be used to explicitly select the kind of high level resource that will deploy the integration. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The deployer trait is a platform trait : disabling it may compromise the platform functionality. 6.3.5.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait deployer.[key]=[value] --trait deployer.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description deployer.enabled bool Can be used to enable or disable a trait. All traits share this common property. deployer.kind string Allows to explicitly select the desired deployment kind between deployment , cron-job or knative-service when creating the resources for running the integration. 6.3.6. Deployment Trait The Deployment trait is responsible for generating the Kubernetes deployment that will make sure the integration will run in the cluster. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The deployment trait is a platform trait : disabling it may compromise the platform functionality. 6.3.6.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait deployment.[key]=[value] Integration.java The following configuration options are available: Property Type Description deployment.enabled bool Can be used to enable or disable a trait. All traits share this common property. 6.3.7. Environment Trait The environment trait is used internally to inject standard environment variables in the integration container, such as NAMESPACE , POD_NAME and others. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The environment trait is a platform trait : disabling it may compromise the platform functionality. 6.3.7.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait environment.[key]=[value] --trait environment.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description environment.enabled bool Can be used to enable or disable a trait. All traits share this common property. environment.container-meta bool Enables injection of NAMESPACE and POD_NAME environment variables (default true ) 6.3.8. Error Handler Trait The error-handler is a platform trait used to inject Error Handler source into the integration runtime. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The error-handler trait is a platform trait : disabling it may compromise the platform functionality. 6.3.8.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait error-handler.[key]=[value] --trait error-handler.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description error-handler.enabled bool Can be used to enable or disable a trait. All traits share this common property. error-handler.ref string The error handler ref name provided or found in application properties 6.3.9. Jvm Trait The JVM trait is used to configure the JVM that runs the integration. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The jvm trait is a platform trait : disabling it may compromise the platform functionality. 6.3.9.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait jvm.[key]=[value] --trait jvm.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description jvm.enabled bool Can be used to enable or disable a trait. All traits share this common property. jvm.debug bool Activates remote debugging, so that a debugger can be attached to the JVM, e.g., using port-forwarding jvm.debug-suspend bool Suspends the target JVM immediately before the main class is loaded jvm.print-command bool Prints the command used the start the JVM in the container logs (default true ) jvm.debug-address string Transport address at which to listen for the newly launched JVM (default *:5005 ) jvm.options []string A list of JVM options jvm.classpath string Additional JVM classpath (use Linux classpath separator) 6.3.9.2. Examples Include an additional classpath to the Integration : USD kamel run -t jvm.classpath=/path/to/my-dependency.jar:/path/to/another-dependency.jar ... 6.3.10. Kamelets Trait The kamelets trait is a platform trait used to inject Kamelets into the integration runtime. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The kamelets trait is a platform trait : disabling it may compromise the platform functionality. 6.3.10.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait kamelets.[key]=[value] --trait kamelets.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description kamelets.enabled bool Can be used to enable or disable a trait. All traits share this common property. kamelets.auto bool Automatically inject all referenced Kamelets and their default configuration (enabled by default) kamelets.list string Comma separated list of Kamelet names to load into the current integration 6.3.11. NodeAffinity Trait The NodeAffinity trait enables you to constrain the nodes that the integration pods are eligible to schedule on, through the following paths: Based on labels on the node or with inter-pod affinity and anti-affinity. Based on labels on pods that are already running on the nodes. This trait is disabled by default. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . 6.3.11.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait affinity.[key]=[value] --trait affinity.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description affinity.enabled bool Can be used to enable or disable a trait. All traits share this common property. affinity.pod-affinity bool Always co-locates multiple replicas of the integration in the same node (default false ). affinity.pod-anti-affinity bool Never co-locates multiple replicas of the integration in the same node (default false ). affinity.node-affinity-labels []string Defines a set of nodes the integration pod(s) are eligible to be scheduled on, based on labels on the node. affinity.pod-affinity-labels []string Defines a set of pods (namely those matching the label selector, relative to the given namespace) that the integration pod(s) should be co-located with. affinity.pod-anti-affinity-labels []string Defines a set of pods (namely those matching the label selector, relative to the given namespace) that the integration pod(s) should not be co-located with. 6.3.11.2. Examples To schedule the integration pod(s) on a specific node using the built-in node label kubernetes.io/hostname : USD kamel run -t affinity.node-affinity-labels="kubernetes.io/hostname in(node-66-50.hosted.k8s.tld)" ... To schedule a single integration pod per node (using the Exists operator): USD kamel run -t affinity.pod-anti-affinity-labels="camel.apache.org/integration" ... To co-locate the integration pod(s) with other integration pod(s): USD kamel run -t affinity.pod-affinity-labels="camel.apache.org/integration in(it1, it2)" ... The *-labels options follow the requirements from Label selectors . They can be multi-valuated, then the requirements list is ANDed, e.g., to schedule a single integration pod per node AND not co-located with the Camel K operator pod(s): USD kamel run -t affinity.pod-anti-affinity-labels="camel.apache.org/integration" -t affinity.pod-anti-affinity-labels="camel.apache.org/component=operator" ... More information can be found in the official Kubernetes documentation about Assigning Pods to Nodes . 6.3.12. Openapi Trait The OpenAPI DSL trait is internally used to allow creating integrations from a OpenAPI specs. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The openapi trait is a platform trait : disabling it may compromise the platform functionality. 6.3.12.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait openapi.[key]=[value] Integration.java The following configuration options are available: Property Type Description openapi.enabled bool Can be used to enable or disable a trait. All traits share this common property. 6.3.13. Owner Trait The Owner trait ensures that all created resources belong to the integration being created and transfers annotations and labels on the integration onto these owned resources. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The owner trait is a platform trait : disabling it may compromise the platform functionality. 6.3.13.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait owner.[key]=[value] --trait owner.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description owner.enabled bool Can be used to enable or disable a trait. All traits share this common property. owner.target-annotations []string The set of annotations to be transferred owner.target-labels []string The set of labels to be transferred 6.3.14. Platform Trait The platform trait is a base trait that is used to assign an integration platform to an integration. In case the platform is missing, the trait is allowed to create a default platform. This feature is especially useful in contexts where there's no need to provide a custom configuration for the platform (e.g. on OpenShift the default settings work, since there's an embedded container image registry). This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The platform trait is a platform trait : disabling it may compromise the platform functionality. 6.3.14.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait platform.[key]=[value] --trait platform.[key2]=[value2] Integration.java The following configuration options are available: Property Type Description platform.enabled bool Can be used to enable or disable a trait. All traits share this common property. platform.create-default bool To create a default (empty) platform when the platform is missing. platform.global bool Indicates if the platform should be created globally in the case of global operator (default true). platform.auto bool To automatically detect from the environment if a default platform can be created (it will be created on OpenShift only). 6.3.15. Quarkus Trait The Quarkus trait activates the Quarkus runtime. It's enabled by default. Note Compiling to a native executable, i.e. when using package-type=native , is only supported for kamelets, as well as YAML integrations. It also requires at least 4GiB of memory, so the Pod running the native build, that is either the operator Pod, or the build Pod (depending on the build strategy configured for the platform), must have enough memory available. This trait is available in the following profiles: Kubernetes, Knative, OpenShift . Warning The quarkus trait is a platform trait : disabling it may compromise the platform functionality. 6.3.15.1. Configuration Trait properties can be specified when running any integration with the CLI: USD kamel run --trait quarkus.[key]=[value] --trait quarkus.[key2]=[value2] integration.java The following configuration options are available: Property Type Description quarkus.enabled bool Can be used to enable or disable a trait. All traits share this common property. quarkus.package-type []github.com/apache/camel-k/pkg/trait.quarkusPackageType The Quarkus package types, either fast-jar or native (default fast-jar ). In case both fast-jar and native are specified, two IntegrationKit resources are created, with the native kit having precedence over the fast-jar one once ready. The order influences the resolution of the current kit for the integration. The kit corresponding to the first package type will be assigned to the integration in case no existing kit that matches the integration exists. 6.3.15.2. Supported Camel Components Camel K only supports the Camel components that are available as Camel Quarkus Extensions out-of-the-box. 6.3.15.3. Examples 6.3.15.3.1. Automatic Rollout Deployment to Native Integration While the compilation to native executables produces integrations that start faster and consume less memory at runtime, the build process is resources intensive, and takes a longer time than the packaging to traditional Java applications. In order to combine the best of both worlds, it's possible to configure the Quarkus trait to run both traditional and native builds in parallel when running an integration, e.g.: USD kamel run -t quarkus.package-type=fast-jar -t quarkus.package-type=native ... The integration pod will run as soon as the fast-jar build completes, and a rollout deployment to the native image will be triggered, as soon as the native build completes, with no service interruption.

Commands:
kamel run --trait service.enabled=false my-integration.yaml
kamel run --trait knative.[key]=[value] --trait knative.[key2]=[value2] integration.java
kamel run --trait knative-service.[key]=[value] --trait knative-service.[key2]=[value2] Integration.java
kamel run --trait prometheus.[key]=[value] --trait prometheus.[key2]=[value2] Integration.java
kamel run --trait pdb.[key]=[value] --trait pdb.[key2]=[value2] Integration.java
kamel run --trait pull-secret.[key]=[value] --trait pull-secret.[key2]=[value2] Integration.java
kamel run --trait route.[key]=[value] --trait route.[key2]=[value2] integration.java
openssl genrsa -out tls.key openssl req -new -key tls.key -out csr.csr -subj "/CN=my-server.com" openssl x509 -req -in csr.csr -signkey tls.key -out tls.crt create secret tls my-combined-certs --key=tls.key --cert=tls.crt
curl -k https://platform-http-server-`oc config view --minify -o 'jsonpath={..namespace}'`.`oc get dnses/cluster -ojsonpath='{.spec.baseDomain}'`/hello?name=Camel-K
kamel run --dev PlatformHttpServer.java -t route.tls-termination=edge -t route.tls-certificate-secret=my-combined-certs/tls.crt -t route.tls-key-secret=my-combined-certs/tls.key
kamel run --dev PlatformHttpServer.java --resource secret:my-combined-certs@/etc/ssl/my-combined-certs -p quarkus.http.ssl.certificate.file=/etc/ssl/my-combined-certs/tls.crt -p quarkus.http.ssl.certificate.key-file=/etc/ssl/my-combined-certs/tls.key -t route.tls-termination=passthrough -t container.port=8443
kamel run --dev PlatformHttpServer.java --resource secret:my-combined-certs@/etc/ssl/my-combined-certs -p quarkus.http.ssl.certificate.file=/etc/ssl/my-combined-certs/tls.crt -p quarkus.http.ssl.certificate.key-file=/etc/ssl/my-combined-certs/tls.key -t route.tls-termination=reencrypt -t route.tls-destination-ca-certificate-secret=my-combined-certs/tls.crt -t route.tls-certificate-secret=my-combined-certs/tls.crt -t route.tls-key-secret=my-combined-certs/tls.key -t container.port=8443
kamel run --dev PlatformHttpServer.java --resource secret:cert-from-openshift@/etc/ssl/cert-from-openshift -p quarkus.http.ssl.certificate.file=/etc/ssl/cert-from-openshift/tls.crt -p quarkus.http.ssl.certificate.key-file=/etc/ssl/cert-from-openshift/tls.key -t route.tls-termination=reencrypt -t route.tls-certificate-secret=my-combined-certs/tls.crt -t route.tls-key-secret=my-combined-certs/tls.key -t container.port=8443
annotate service platform-http-server service.beta.openshift.io/serving-cert-secret-name=cert-from-openshift
kamel run PlatformHttpServer.java --dev -t route.tls-termination=edge -t route.tls-certificate="USD(cat tls.crt|awk 'NF {sub(/\r/, ""); printf "%s\\n",USD0;}')" -t route.tls-key="USD(cat tls.key|awk 'NF {sub(/\r/, ""); printf "%s\\n",USD0;}')"
kamel run --trait service.[key]=[value] --trait service.[key2]=[value2] Integration.java
kamel run --trait builder.[key]=[value] --trait builder.[key2]=[value2] Integration.java
kamel run --trait container.[key]=[value] --trait container.[key2]=[value2] Integration.java
kamel run --trait camel.[key]=[value] --trait camel.[key2]=[value2] Integration.java
kamel run --trait dependencies.[key]=[value] Integration.java
kamel run --trait deployer.[key]=[value] --trait deployer.[key2]=[value2] Integration.java
kamel run --trait deployment.[key]=[value] Integration.java
kamel run --trait environment.[key]=[value] --trait environment.[key2]=[value2] Integration.java
kamel run --trait error-handler.[key]=[value] --trait error-handler.[key2]=[value2] Integration.java
kamel run --trait jvm.[key]=[value] --trait jvm.[key2]=[value2] Integration.java
kamel run -t jvm.classpath=/path/to/my-dependency.jar:/path/to/another-dependency.jar
kamel run --trait kamelets.[key]=[value] --trait kamelets.[key2]=[value2] Integration.java
kamel run --trait affinity.[key]=[value] --trait affinity.[key2]=[value2] Integration.java
kamel run -t affinity.node-affinity-labels="kubernetes.io/hostname in(node-66-50.hosted.k8s.tld)"
kamel run -t affinity.pod-anti-affinity-labels="camel.apache.org/integration"
kamel run -t affinity.pod-affinity-labels="camel.apache.org/integration in(it1, it2)"
kamel run -t affinity.pod-anti-affinity-labels="camel.apache.org/integration" -t affinity.pod-anti-affinity-labels="camel.apache.org/component=operator"
kamel run --trait openapi.[key]=[value] Integration.java
kamel run --trait owner.[key]=[value] --trait owner.[key2]=[value2] Integration.java
kamel run --trait platform.[key]=[value] --trait platform.[key2]=[value2] Integration.java
kamel run --trait quarkus.[key]=[value] --trait quarkus.[key2]=[value2] integration.java
kamel run -t quarkus.package-type=fast-jar -t quarkus.package-type=native