Update: The question had been answered under Camel K GitHub Issues: https://github.com/apache/camel-k/issues/2693
I have a Camel K project and it uses port 4739. Now I am only able to send data to the port when log into the pod container.
I am trying to send data outside of the container, does anyone know how to configure?
The following command has been tried but seems not working...
// Split commands into multiple lines for easy read
kamel run
--trait container.enabled=true
--trait container.expose=true
--trait container.port=4739
--trait service.node-port=true
SyslogBasic.java --dev
My understanding is container is living inside of a pod. Firstly we need to expose the container port to pod and then use service to expose the port to outside, unfortunately I haven't find any command line related to service port.
(base) ➜ ~ kamel describe integration syslog-basic
Name: syslog-basic
Namespace: camel-basic
Creation Timestamp: Fri, 08 Oct 2021 15:31:27 -0600
Phase: Running
Runtime Version: 1.9.0
Kit: camel-basic/kit-c59mu55np3m8mfiq07hg
Image: 10.100.204.194/camel-basic/camel-k-kit-c59mu55np3m8mfiq07hg@sha256:06d02dbdda3a58fa0428b9d7cccab9d0708a0172ebe1a9c37e9c1ad114d46769
Version: 1.6.0
Dependencies:
camel:log
camel:netty
mvn:com.fasterxml.jackson.core:jackson-databind:2.12.5
mvn:io.quarkus:quarkus-logging-json
mvn:org.apache.camel.k:camel-k-runtime
mvn:org.apache.camel.quarkus:camel-quarkus-java-joor-dsl
mvn:org.apache.camel:camel-syslog:3.11.2
Sources:
Name Language Compression Ref Ref Key
SyslogBasic.java java false
Conditions:
Type Status Reason Message
IntegrationPlatformAvailable True IntegrationPlatformAvailable camel-basic/camel-k
IntegrationKitAvailable True IntegrationKitAvailable kit-c59mu55np3m8mfiq07hg
CronJobAvailable False CronJobNotAvailableReason different controller strategy used (deployment)
DeploymentAvailable True DeploymentAvailable deployment name is syslog-basic
ServiceAvailable False ServiceNotAvailable no http service required
ExposureAvailable False IngressNotAvailable no host or service defined
Ready True ReplicaSetReady
Traits:
Container:
Configuration: map[enabled:true expose:true port:4739]
Service:
Configuration: map[enabled:true nodePort:true]
As of Camel K version 1.6, the auto-configuration of the container port is only available for the HTTP protocol, as reported by the condition:
You can achieve it manually, by exposing the container port using the
kamel run --pod-template
option, with the followingtemplate.yaml
file:And creating the Service manually, e.g.:
Then you can run the integration with:
And send a Syslog trace using Netcat, e.g.:
Finally you can check in the integration logs the trace has been processed, e.g.: