camel-k icon indicating copy to clipboard operation
camel-k copied to clipboard

Unable to get basic hello.groovy example working on local single node KIND cluster

Open bjethwan opened this issue 2 years ago • 8 comments

% kubectl version --short
Client Version: v1.23.1
Server Version: v1.21.1
% kamel version
Camel K Client 1.8.1

https://camel.apache.org/camel-k/1.9.x/running/running.html

kamel run hello.groovy

{"level":"info","ts":1654957525.8224964,"logger":"camel-k","msg":"spectrum - 2022/06/11 14:25:25 Pulling base image adoptopenjdk/openjdk11:slim (insecure=false)..."}
{"level":"error","ts":1654957556.1208284,"logger":"camel-k.controller.build","msg":"Build kit-caiaa4tp090c73cco220 failed: could not pull base image image adoptopenjdk/openjdk11:slim: Get \"https://auth.docker.io/token?scope=repository%3Aadoptopenjdk%2Fopenjdk11%3Apull&service=registry.docker.io\": dial tcp: i/o timeout","request-namespace":"default","request-name":"kit-caiaa4tp090c73cco220","api-version":"camel.apache.org/v1","kind":"Build","ns":"default","name":"kit-caiaa4tp090c73cco220"}
{"level":"info","ts":1654957556.1424239,"logger":"camel-k.controller.build","msg":"state transition","request-namespace":"default","request-name":"kit-caiaa4tp090c73cco220","api-version":"camel.apache.org/v1","kind":"Build","ns":"default","name":"kit-caiaa4tp090c73cco220","phase-from":"Running","phase-to":"Failed"}

It's such a stupid thing that every time it fails to download the base image it again enters in the complete maven build cycle.

bjethwan avatar Jun 11 '22 14:06 bjethwan

% kamel local build --image=docker.io/bjethwan/hello hello.groovy
failure while building project: exit status 1

bjethwan avatar Jun 11 '22 14:06 bjethwan

Does it have to build the image every time I run "kamel run hello.groovy"?

bjethwan avatar Jun 11 '22 14:06 bjethwan

You don't need kamel local build at all for just deploying an integration to a K8s cluster.

Looking at the log, it appears that there is something wrong with the registry settings. Make sure you followed the steps here with the correct credentials: https://camel.apache.org/camel-k/1.9.x/installation/platform/kind.html

tadayosi avatar Jun 13 '22 03:06 tadayosi

@tadayosi I did follow the steps given in https://camel.apache.org/camel-k/1.9.x/installation/platform/kind.html

In fact today I followed the approach

docker login
kubectl create secret generic your-secret-name --from-file ~/.docker/config.json
kamel install --registry docker.io --organization bjethwan --registry-secret your-secret-name

camel-k-example-basic
kamel run Basic.java --dev

{"level":"error","ts":1657137515.1099386,"logger":"camel-k.controller.build","msg":"Build kit-cb2uilvssj1s73ektehg failed: could not pull base image image adoptopenjdk/openjdk11:slim: error getting credentials - err: exec: \"docker-credential-desktop\": executable file not found in $PATH, out: ``","request-namespace":"default","request-name":"kit-cb2uilvssj1s73ektehg","api-version":"camel.apache.org/v1","kind":"Build","ns":"default","name":"kit-cb2uilvssj1s73ektehg"}

{"level":"error","ts":1657138272.6890378,"logger":"camel-k.controller.build","msg":"Build kit-cb2ukqvssj1s73a7kvig failed: could not pull base image image adoptopenjdk/openjdk11:slim: Get \"https://auth.docker.io/token?scope=repository%3Aadoptopenjdk%2Fopenjdk11%3Apull&service=registry.docker.io\": dial tcp: i/o timeout","request-namespace":"default","request-name":"kit-cb2ukqvssj1s73a7kvig","api-version":"camel.apache.org/v1","kind":"Build","ns":"default","name":"kit-cb2ukqvssj1s73a7kvig"}

bjethwan avatar Jul 06 '22 20:07 bjethwan

@tadayosi It did work. I guess it was the network. I changed to mobile hotspot and it worked.

Question: When I re-created the KIND cluster and ran the same integration again, it created the docker image once again when I didn't change a thing in the Integration file Basic.java. Is there some way to tell it not to build again but re-use the image from last time?

bjethwan avatar Jul 06 '22 20:07 bjethwan

@bjethwan If you've just uninstalled Camel K operator, the IntegrationKits used for the build is still there. So long as you keep the IntegrationKits Camel K won't recreate the container image with the hash. As you say, if you recreate the entire kind cluster, or you deleted the entire namespace, the IntegrationKits are also gone and you'll need to rebuild the images.

tadayosi avatar Jul 07 '22 05:07 tadayosi

@tadayosi So if I take this solution to production, camel-k will not use the tested kit-* but recreate a new one? Can't I export and import the integrationkit? Will that skip camel-k from rebuilding in production env?

bjethwan avatar Jul 07 '22 09:07 bjethwan

I think the new kamel promote (https://github.com/apache/camel-k/pull/3325) may be your solution. You can already use installing nightly build or waiting for 1.10 release.

squakez avatar Jul 07 '22 10:07 squakez

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!

github-actions[bot] avatar Oct 06 '22 00:10 github-actions[bot]