You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Is it possible to use AWS ECR as repository for K3S running on AWS EC2 #1427
It appears that containerd does not support external credential helpers like docker does. See: https://github.com/containerd/cri/issues/1131. This would prevent you from being able to authenticate to ECR when using the default containerd backend.
@HuJake did you actually install the out-of-tree aws cloud provider, set up the aws credential helper, and configure docker registry auth to use the helper?
@bigbohne will it actually re-read it, or is it just loaded on startup? I couldn't tell.
With docker as container engine this is easily possible using the ecr-credential-helper. But what about containerd? Or is it a design decision to not include plugable authenticators?
The "registry creds" project didn't work for me, I ran into upmc-enterprises/registry-creds#97. However, I was able to get auth working with K3s by slightly editing this script for my needs: https://stackoverflow.com/a/55658863
Requires the aws cli to be installed on your servers
Edit k8s/deployment.yaml and secret.yaml to suit your needs. For me, I removed everything ACR/GCR/DPR and only kept the ECR stuff. I also added the reference to the new service account and added a missing env for AWS_SESSION_TOKEN:
Activity
HuJake commentedon May 20, 2020
We also want to ask this question.
brandond commentedon May 20, 2020
It appears that containerd does not support external credential helpers like docker does. See: https://github.com/containerd/cri/issues/1131. This would prevent you from being able to authenticate to ECR when using the default containerd backend.
HuJake commentedon May 20, 2020
@brandond thanks your reply my question.
We have changed it to docker but after setting the following flag
Seems unable to solve..
It seems there is no information to refer to
bigbohne commentedon May 20, 2020
not nice but you can always generate the
/etc/rancher/k3s/registries.yamlusing crontab ...brandond commentedon May 21, 2020
@HuJake did you actually install the out-of-tree aws cloud provider, set up the aws credential helper, and configure docker registry auth to use the helper?
@bigbohne will it actually re-read it, or is it just loaded on startup? I couldn't tell.
HuJake commentedon May 21, 2020
@brandond
I simply set the relevant flag,
I'm want to use [aws cloud provider] but not sure how to apply related yaml?
Are there references to successful cases?
thanks
brandond commentedon May 22, 2020
@HuJake All that does is set the ID. If you want a full cloud provider you can find deployment documentation at https://github.com/kubernetes/cloud-provider-aws. For authenticating Docker to ECR for image pulls you would want https://github.com/awslabs/amazon-ecr-credential-helper.
bigbohne commentedon Jun 23, 2020
With docker as container engine this is easily possible using the ecr-credential-helper. But what about containerd? Or is it a design decision to not include plugable authenticators?
brandond commentedon Jun 23, 2020
The containerd folks seem to have philosophical issues that preclude them from adding support for pluggable authentication.
bigbohne commentedon Jun 24, 2020
Than it is what it is ...
brandond commentedon Jun 24, 2020
@bigbohne see https://github.com/containerd/cri/issues/1131#issuecomment-631633816
canadiannomad commentedon Jul 30, 2020
I'm wondering the same... I can easily write a cronjob to grab new creds, but restarting k3s every time....?
brandond commentedon Oct 21, 2020
Probably related: awslabs/amazon-ecr-credential-helper#210
KennyReeldata commentedon Nov 26, 2020
The "registry creds" project didn't work for me, I ran into upmc-enterprises/registry-creds#97. However, I was able to get auth working with K3s by slightly editing this script for my needs: https://stackoverflow.com/a/55658863
Requires the aws cli to be installed on your servers
johnlane commentedon Feb 10, 2021
Just in case it's useful.... I'm running k3s locally with the docker backend and I was able to pull from ecr using information from here and here.
mandrean commentedon Feb 18, 2021
@urupaud I got it working by:
$ git clone github.com/upmc-enterprises/registry-credk8s/rbac.yaml:k8s/deployment.yamlandsecret.yamlto suit your needs. For me, I removed everything ACR/GCR/DPR and only kept the ECR stuff. I also added the reference to the new service account and added a missing env forAWS_SESSION_TOKEN:$ kubectl apply -f k8s/awsecr-credas an image pull secret to any deployment using images in ECR:$ kubectl logs -l name=registry-creds -n kube-system --tail 1000 | grep "Updated secret awsecr-cred"should return something like:moonape1226 commentedon Mar 3, 2021
@mandrean
Your solution above works like a charm on my on-premises K3S cluster. Thanks a lot.