Pull images from ECR using Kubelet credential provider is not working in Microk8s

105 Views Asked by At

I am trying to configure a kubelet image credential provider to pull images from an ECR private registry. It looks like the 'ecr-credential-provider' gets registered but never pulls image from ECR. I am expecting that the credential provider should pull images from my private registry.

Here are the steps that I followed.

  1. Create a new file /var/snap/microk8s/common/credential-provider-config.yaml with the following content.
apiVersion: kubelet.config.k8s.io/v1
kind: CredentialProviderConfig
providers:
  - name: ecr-credential-provider
    apiVersion: credentialprovider.kubelet.k8s.io/v1
    matchImages:
      - "*.dkr.ecr.*.amazonaws.com"
    defaultCacheDuration: 12h
  1. Add following arguments in file /var/snap/microk8s/current/args/kubelet. The credential provider binary is /usr/local/bin/ecr-credential-provider.
--image-credential-provider-config=${SNAP_COMMON}/credential-provider-config.yaml
--image-credential-provider-bin-dir=/usr/local/bin/
  1. Restart Microk8s
  2. Create a Pod that uses images in my repository.
0

There are 0 best solutions below