Skip to content

Error: failed to download oci://localhost:5001/test-chart with Kind and local registry #168

@mathieu-benoit

Description

@mathieu-benoit

I'm trying to sync an Helm chart with Config Sync installed in Kind with a local registry, but I'm getting this error on my RootSync:

KNV2004: unable to sync repo
          Error in the helm-sync container: {"Msg":"unexpected error rendering chart, will retry","Err":"failed to render the helm chart: exit status 1, stdout: Error: failed to download \"oci://localhost:5001/test-chart\" at version \"1.0.0\"\n","Args":{}}

Here is my setup to reproduce:

## Set up Kind with local registry
reg_name='kind-registry'
reg_port='5001'
reg_internal_port='5000'
docker run \
    -d --restart=always -p "127.0.0.1:${reg_port}:${reg_internal_port}" --name "${reg_name}" \
    registry:2
cat <<EOF | ./kind create cluster --image kindest/node:v1.24.6 --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
- |-
  [plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port}"]
    endpoint = ["http://${reg_name}:${reg_internal_port}"]
EOF
docker network connect "kind" "${reg_name}"
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
  name: local-registry-hosting
  namespace: kube-public
data:
  localRegistryHosting.v1: |
    host: "localhost:${reg_port}"
    hostFromContainerRuntime: "${reg_name}:${reg_internal_port}"
    hostFromClusterNetwork: "${reg_name}:${reg_internal_port}"
    help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
EOF

## Install CS
kubectl apply -f https://github.com/GoogleContainerTools/kpt-config-sync/releases/download/v1.13.0/config-sync-manifest.yaml

## Create local Helm chart
helm create test-chart
helm package test-chart --version 1.0.0
helm push test-chart-1.0.0.tgz oci://localhost:${reg_port}

## Confirming that I can successfully pull the Helm chart from the local registry
helm pull oci://localhost:${reg_port}/test-chart --version 1.0.0

## Sync local Helm chart
cat << EOF | kubectl apply -f -
apiVersion: configsync.gke.io/v1beta1
kind: RootSync
metadata:
  name: root-sync
  namespace: config-management-system
spec:
  sourceFormat: unstructured
  sourceType: helm
  helm:
    repo: oci://localhost:${reg_port}
    chart: test-chart
    version: 1.0.0
    releaseName: test-chart
    auth: none
EOF

JFYI, if I don't use the local registry setup, but instead use a public Helm chart in GHCR, it's working successfully:

cat << EOF | kubectl apply -f -
apiVersion: configsync.gke.io/v1beta1
kind: RootSync
metadata:
  name: root-sync
  namespace: config-management-system
spec:
  sourceFormat: unstructured
  sourceType: helm
  helm:
    repo: oci://ghcr.io/mathieu-benoit
    chart: my-chart
    version: 0.1.0
    releaseName: my-chart
    auth: none
EOF

Also, I confirm that this docker flow is working successfully with this setup too:

docker pull gcr.io/google-samples/hello-app:1.0
docker tag gcr.io/google-samples/hello-app:1.0 localhost:${reg_port}/hello-app:1.0
docker push localhost:${reg_port}/hello-app:1.0
kubectl create deployment hello-server --image=localhost:${reg_port}/hello-app:1.0

Not sure if the error is coming from the Kind setup or from Config Sync, so logging this here.
CC: @nan-yu @xinnywinne

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions