Skip to content
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

How to package integration to deploy it into a private k8s cluster without internet connection #2737

Closed
elainhelen opened this issue Nov 8, 2021 · 9 comments

Comments

@elainhelen
Copy link

Newbie here
Is it possible to package Camel K integration as a self-sufficient container image?
If not, what is the package strategy for Camel K integration?

Given that the k8s cluster is private, what do we need to pre-package on the private k8s cluster for running the integration?
thank you

@elainhelen
Copy link
Author

I got a bit ahead, but have more questions on kamel local
I used kamel local build basic.java --image xxxx/basic-image
which creates an image xxxx/basic-image on my local development machine.
Then move the image to the private k8s cluster and run kamel local run --image xxxx/basic-image
and it executed: docker run --network=host -t xxxx/basic-image:latest and started to output logs

{"timestamp":"2021-11-08T23:44:44.255Z","sequence":95,"loggerClassName":"org.slf4j.impl.Slf4jLogger","loggerName":"org.apache.camel.k.Runtime","level":"INFO","message":"Apache Camel K Runtime 1.9.1","threadName":"main","threadId":1,"mdc":{},"ndc":"","hostName":"docker-desktop","processName":"io.quarkus.bootstrap.runner.QuarkusEntryPoint","processId":9}
{"timestamp":"2021-11-08T23:44:44.281Z","sequence":96,"loggerClassName":"org.jboss.logging.Logger","loggerName":"org.apache.camel.quarkus.core.CamelBootstrapRecorder","level":"INFO","message":"Bootstrap runtime: org.apache.camel.quarkus.main.CamelMainRuntime","threadName":"main","threadId":1,"mdc":{},"ndc":"","hostName":"docker-desktop","processName":"io.quarkus.bootstrap.runner.QuarkusEntryPoint","processId":9}
{"timestamp":"2021-11-08T23:44:44.3Z","sequence":97,"loggerClassName"

Questions:
What is the usage of the base image (ex. xxxx/integration-base-image) created from
kamel local build --base-image --container-registry xxxx ?
Can I use this image to run the integration-directory created from kamel local build basic.java --integration-directory ~/test/int ?

Tried to run kamel local run --containerize --image xxxx/integration-base-image --integration-directory ~/test/int
Got the following error

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Executing: docker run --network=host -t xxxx/integration-base-image:latest
Exception in thread "main" java.nio.file.NoSuchFileException: /quarkus/quarkus-application.dat
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
	at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
	at java.base/java.nio.file.Files.newByteChannel(Files.java:422)
	at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420)
	at java.base/java.nio.file.Files.newInputStream(Files.java:156)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:41)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:25)
integration image did not run successfully: exit status 1

Is it feasible to pre-package one base image? and use it to run/load different integrations from their own integration-directory

@squakez
Copy link
Contributor

squakez commented Nov 10, 2021

Not sure if the kamel local is the best strategy to adopt. It involves too many low level details that are coming for free using an operator. I think it would be better if you have a connected environment where installing an operator and leverage the IntegrationKit as a way to package your self-contained resources. Then you can move those kits into the private cluster and be able to reuse there.

@elainhelen
Copy link
Author

@squakez really helpful suggestion.
I have revised the workflow
kamel kit create kit_name -d denpency
This created an image without tag
docker_registry/camel-k-kit_name@sha256:3a0cb7ddb5917df8e9a0f16e7ebac746777bd02257c0078e6919db658375f229
Is there a way to give a tag when creating the kit?

@squakez
Copy link
Contributor

squakez commented Nov 17, 2021

Hi @elainhelen, I don't think we have that option available now. The images created have a unique autogenerated ID instead. I understand that in your situation it may help in order to simplify versioning. I don't know the impact of including any additional property (ie, a tag) when we create the IntegrationKit, so, I suggest you to create a new issue describing the feature requested. Of course, feel free to have a look to the code and contribute to the analysis/development as well.

Let me know if there is anything else I can help you with.

@elainhelen
Copy link
Author

@squakez I haven't done a lot on kamelet.
With kamelet in the picture, what is the shareable artifact we can build locally and then load into a production env?
Thanks

@squakez
Copy link
Contributor

squakez commented Nov 19, 2021

A Kamelet is essentially a descriptor that will be somehow translated at runtime. In the context of this deployment requirement, I don't think you will need it, once you have your IntegrationKit and Integration defined.

@zhiminglim
Copy link
Contributor

@elainhelen if I may join in this thread, I have a question with regards to how you manage to perform kamel local build xxx.java as I'm too looking for a solution to a use case similar to yours.

I'm using Camel K Client 1.6.0, and when I did a kamel local build --integration-directory test Basic.java, it is returning an error without stack trace.

> kamel local build --integration-directory test Basic.java
failure while building project: exit status 1

Is there anything in particular you have to set up in advance before running the above command?

@squakez
Copy link
Contributor

squakez commented Nov 22, 2021

@elainhelen if I may join in this thread, I have a question with regards to how you manage to perform kamel local build xxx.java as I'm too looking for a solution to a use case similar to yours.

I'm using Camel K Client 1.6.0, and when I did a kamel local build --integration-directory test Basic.java, it is returning an error without stack trace.

> kamel local build --integration-directory test Basic.java
failure while building project: exit status 1

Is there anything in particular you have to set up in advance before running the above command?

The local is performed on your machine, so you must make sure that you have all the expected tools required by the build process, ie, maven, jdk, quarkus, ... it seems that your error happens when you try to package the application, so, likely, you don't have all the required configuration needed to run.

@github-actions
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants