New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose UDP port using traits and make it accessible outside of the pod #2693
Comments
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 containers:
- name: integration
ports:
- containerPort: 8443
protocol: UDP And creating the Service manually, e.g.: $ 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: $ kamel run SysLogBasic.java --pod-template template.yaml -d camel-syslog And send a Syslog trace using Netcat, e.g.: $ 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.: $ 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 issue has been automatically marked as stale due to 90 days of inactivity. |
I have started a Java integration which is listening on port
8843
. The integration works properly and it can receive syslog events in the container of the pod. I am trying to expose the port and makes it accessible outside of the pod, what is the right way to expose it?I have tried added traits but don't have any luck, I have asked the question on StackOverflow can some shed some light on this?
The text was updated successfully, but these errors were encountered: