essobedo commented on issue #4256:
URL: https://github.com/apache/camel-k/issues/4256#issuecomment-1507371639

   What you are looking for is port forwarding 
https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/
   
   Camel-K should have created a service automatically for you.
   
   You can check it with the next command:
   
   ```
   kubectl get svc -n <your-namespace-here>                     
   NAME       TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE
   rest-dsl   ClusterIP   10.96.195.112   <none>        80/TCP    82s
   ```
   
   In the previous example, the service `rest-dsl` is listening on port `80` so 
assuming that you would like to access your application from port `8080` on 
your local machine, the  corresponding `port-forward` command is then:
   ```
   kubectl port-forward svc/rest-dsl 8080:80 -n <your-namespace-here>
   ```
   
   The code of the integration that I used:
   ```
   import org.apache.camel.builder.RouteBuilder;
   import org.apache.camel.Exchange;
   
   public class RestDSL extends RouteBuilder {
   
       @Override
       public void configure() throws Exception {
        rest()
                .get("/hello")
                .to("direct:hello");
           from("direct:hello")
                .setHeader(Exchange.CONTENT_TYPE, constant("text/plain"))
               .transform().simple("Hello, Camel K");
       }
   }
   ```


-- 
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