astefanutti edited a comment on issue #2693:
URL: https://github.com/apache/camel-k/issues/2693#issuecomment-943146900


   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:
   
   ```
   Conditions:
     Type              Status  Reason               Message
     ServiceAvailable  False   ServiceNotAvailable  no http service required
   ```
   
   You can achieve it manually, by exposing the container port using the `kamel 
run --pod-template` option, with the following `template.yaml` file:
   
   ```yaml
   containers:
     - name: integration
       ports:
         - containerPort: 8443
           protocol: UDP
   ```
   
   And creating the Service manually, e.g.:
   
   ```sh
   $ cat <<EOF | kubectl apply -f -
   apiVersion: v1
   kind: Service
   metadata:
     name: service
   spec:
     selector:
       camel.apache.org/integration: sys-log-basic
     ports:
       - protocol: UDP
         port: 8443
         targetPort: 8443
   EOF
   ```
   
   Then you can run the integration with:
   
   ```sh
   $ kamel run SysLogBasic.java --pod-template template.yaml -d camel-syslog
   ```
   
   And send a Syslog trace using Netcat, e.g.:
   
   ```sh
   $ kubectl run -i --rm debug --image=busybox --restart=Never --command -- sh 
-c "echo '<34>Oct 11 22:14:15 mymachine su: failed on /dev/pts/8' | nc -u -w1 
service 8443"
   ```
   
   Finally you can check in the integration logs the trace has been processed, 
e.g.:
   
   ```console
   $ kubectl logs -l camel.apache.org/integration=sys-log-basic
   2021-10-14 08:09:36,436 INFO  [io.quarkus] (main) camel-k-integration 
1.7.0-SNAPSHOT on JVM (powered by Quarkus 2.2.0.Final) started in 1.684s. 
   2021-10-14 08:09:36,436 INFO  [io.quarkus] (main) Profile prod activated. 
   2021-10-14 08:09:36,437 INFO  [io.quarkus] (main) Installed features: 
[camel-bean, camel-core, camel-java-joor-dsl, camel-k-core, camel-k-runtime, 
camel-log, camel-netty, camel-syslog, cdi]
   2021-10-14 08:39:06,842 INFO  [info] (Camel (camel-1) thread #1 - 
NettyConsumerExecutorGroup) Exchange[ExchangePattern: InOnly, BodyType: 
org.apache.camel.component.syslog.SyslogMessage, Body: <34>Oct 11 22:14:15 
mymachine su: failed on /dev/pts/8]
   ```
   
   I've re-titled the issue to make it specific to UDP. We'll work on it ASAP.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to