fvcortes opened a new issue, #4158:
URL: https://github.com/apache/camel-k/issues/4158

   **Actual behaviour**
   
   When creating an Integration with kaniko build strategy and Docker Desktop, 
kaniko container ends with:
    `kaniko should only be run inside of a container, run with the --force flag 
if you are sure you want to continue` 
   
   **Expected behaviour**
   camel-k-kit builder pod should have STATUS Completed
   
   **Steps to reproduce**
   First, have a docker desktop installation running on linux machine. 
Installed as described 
[here](https://docs.docker.com/desktop/install/linux-install/)
   
   * Check docker context
   ```
   $ docker context ls
   NAME            DESCRIPTION                               DOCKER ENDPOINT    
                              ...
   default         Current DOCKER_HOST based configuration   
unix:///var/run/docker.sock                      ...
   desktop-linux *                                           
unix:///home/<user>/.docker/desktop/docker.sock  ...
   ```
   
   * Create a GCP Service Account configure gcr.io registry correctly as 
described 
[here](https://camel.apache.org/camel-k/1.11.x/installation/registry/gcr.html)
   
   Note: before installing camel-k on cluster, create a docker-registry secret 
with the downloaded json key
   
   ```
   $ kubectl create secret docker-registry gcr-json-key \
    --docker-server=gcr.io \
    --docker-username=_json_key \
    --docker-password="$(cat <downloaded-key-name>.json)" \
    --docker-email=any@valid.email
   ```
   
   * Wait for IntegrationPlatform to be Ready
   `$ kubectl get IntegrationPlatform`
   
   * Edit spec traits to include registry secret
   `$ kubectl edit IntegrationPlatform camel-k`
   
   add traits spec:
   ```yaml
     traits:
       pull-secret:
         secretName: gcr-json-key
   ```
   
   * Create a custom integration file with basic Integration template
   
   ```yaml
   apiVersion: camel.apache.org/v1
   kind: Integration
   metadata:
     name: test  
   spec:
     sources:
     - name: main.groovy
       content: |-
         rest("/test")
             .post()
             .to("direct:start")
   
         from("direct:start").to("log:info")
   ```
   * Apply integration
   `$ kubectl apply -f integration.yaml`
   
   * Wait for camel-k-kit builder container to finish building
   
   ```
   
{"level":"info","ts":1679596880.5453982,"logger":"camel-k.builder","msg":"base 
image: docker.io/eclipse-temurin:11"}
   
{"level":"info","ts":1679596880.545404,"logger":"camel-k.builder","msg":"resolved
 base image: 
gcr.io/registry-ipaas-testing/camel-k-kit-cgab3vp5ive1pd2uvvng:15039554"}
   ```
   * Get kaniko container logs on builder pod
   get builder pod name
   `$ kubectl get pods`
   ```
   NAME                      
   camel-k-kit-cgec2trs3c7ebgv37nd0-builder
   camel-k-operator-9977dd584-8g9v4 
   ```
   get pod logs
   `$ kubectl logs camel-k-kit-cgec2trs3c7ebgv37nd0-builder -f -c kaniko`
   
   Output should be:
   `kaniko should only be run inside of a container, run with the --force flag 
if you are sure you want to continue`
   
   **Problem Resolution**
   
   Changing docker context to use Docker Engine resolved the problem
   `$ docker context use default`
   
   Then recreate Integration.
   
   I know this is a very specific issue, but it's good for the sake of 
documentation, in case someone bumps with a similar error.
   I don't know if this is a kaniko specific error, or relates to camel-k build 
strategy configuration.


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to