You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/10/13 21:01:09 UTC
[GitHub] [camel-k] haifzhan opened a new issue #2693: Expose port using traits and make it accessible outside of the pod
haifzhan opened a new issue #2693:
URL: https://github.com/apache/camel-k/issues/2693
I have an syslog integration Java file which is listening on port `8843`. The integration kit 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: [https://stackoverflow.com/questions/69501857/how-to-expose-a-camel-k-integration-pod-port](url), can some shed some light on this?
```
// 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
```
```
@Override
public void configure() throws Exception {
DataFormat syslogDataFormat = new SyslogDataFormat();
String HOST = "0.0.0.0";
int PORT = 8443;
from("netty:udp://" + HOST + ":" + PORT + "?sync=false").unmarshal(syslogDataFormat).process(new Processor() {
public void process(Exchange exchange) {
// implemented business logic
}
}).to("log:info");
}
```
--
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] github-actions[bot] commented on issue #2693: Expose UDP port using traits and make it accessible outside of the pod
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #2693:
URL: https://github.com/apache/camel-k/issues/2693#issuecomment-1011566858
This issue has been automatically marked as stale due to 90 days of inactivity.
It will be closed if no further activity occurs within 15 days.
If you think that’s incorrect or the issue should never stale, please simply write any comment.
Thanks for your contributions!
--
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] astefanutti commented on issue #2693: Expose UDP port using traits and make it accessible outside of the pod
Posted by GitBox <gi...@apache.org>.
astefanutti commented 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.
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.:
```
$ 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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] astefanutti edited a comment on issue #2693: Expose UDP port using traits and make it accessible outside of the pod
Posted by GitBox <gi...@apache.org>.
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] astefanutti edited a comment on issue #2693: Expose UDP port using traits and make it accessible outside of the pod
Posted by GitBox <gi...@apache.org>.
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.
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] github-actions[bot] closed issue #2693: Expose UDP port using traits and make it accessible outside of the pod
Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #2693:
URL: https://github.com/apache/camel-k/issues/2693
--
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org