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

   Yeah, I know but this error typically happens when kubelet tries to pull a 
docker image from an insecure registry without knowing it is an insecure 
registry.
   
   I could reproduce your problem and confirm that following this doc page 
https://docs.docker.com/registry/insecure/#deploy-a-plain-http-registry doesn't 
help, it is really internal to kind.
   
   To make it work properly, I had to change the script for this:
   ```
   #!/bin/sh
   set -o errexit
   
   # create registry container unless it already exists
   reg_name='kind-registry'
   reg_port='5001'
   if [ "$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || 
true)" != 'true' ]; then
     docker run \
       -d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" 
\
       registry:2
   fi
   
   # create a cluster with the local registry enabled in containerd
   cat <<EOF | kind create cluster --config=-
   kind: Cluster
   apiVersion: kind.x-k8s.io/v1alpha4
   containerdConfigPatches:
   - |-
     [plugins."io.containerd.grpc.v1.cri".registry.mirrors."${reg_name}:5000"]
       endpoint = ["http://${reg_name}:5000";]
   EOF
   
   # connect the registry to the cluster network if not already connected
   if [ "$(docker inspect -f='{{json .NetworkSettings.Networks.kind}}' 
"${reg_name}")" = 'null' ]; then
     docker network connect "kind" "${reg_name}"
   fi
   
   # Document the local registry
   # 
https://github.com/kubernetes/enhancements/tree/master/keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry
   cat <<EOF | kubectl apply -f -
   apiVersion: v1
   kind: ConfigMap
   metadata:
     name: local-registry-hosting
     namespace: kube-public
   data:
     localRegistryHosting.v1: |
       host: "${reg_name}:5000"
       help: "https://kind.sigs.k8s.io/docs/user/local-registry/";
   EOF
   ```
   
   The most significant change here is the way to configure the registry 
mirrors, I changed `localhost:${reg_port}` for `${reg_name}:5000`, this will 
indirectly indicate `kubelet` to pull the images from `${reg_name}:5000` using 
the HTTP protocol instead of HTTPS by default.
   I also change the ConfigMap but it is only meant for documentation so it is 
not really important.
   
   Then your command to install kamel is `kamel install --olm=false 
--maven-repository=https://repository.apache.org/content/repositories/snapshots@id=apache-snapshots@snapshots
 --operator-image kind-registry:5000/apache/camel-k:2.0.0-SNAPSHOT  --registry 
kind-registry:5000 --registry-insecure -n test`.
   
   Please try it and tell me if it works on your side, and if so I will add 
some doc as a fix for this PR.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to