Repository navigation
Replies: 24 comments 14 replies
|
We also want to ask this question. |
|
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. |
|
@brandond thanks your reply my question. We have changed it to docker but after setting the following flag Seems unable to solve.. |
|
not nice but you can always generate the |
|
I simply set the relevant flag, I'm want to use [aws cloud provider] but not sure how to apply related yaml? |
|
@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. |
|
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 containerd folks seem to have philosophical issues that preclude them from adding support for pluggable authentication. |
|
Than it is what it is ... |
|
@bigbohne see https://github.com/containerd/cri/issues/1131#issuecomment-631633816 |
I'm wondering the same... I can easily write a cronjob to grab new creds, but restarting k3s every time....? |
|
We are running k3s with docker as container engine here. I installed and configured the amazon-ecr-credential-helper. A So my understanding of this is that the kubelet service (running inside a docker container) cannot pull the image because it does not know about the credential helper. Any pointers on how to overcome this? |
|
Probably related: awslabs/amazon-ecr-credential-helper#210 |
|
I was able to solve/work around this by deploying registry-creds in my cluster (this is basically what the registry-creds addon in Minikube is doing) |
|
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 |
|
@urupaud I got it working by:
|
|
@mandrean |
|
Something to clarify for those using k3s and containerd (instead of docker). These are the steps that allowed me to use https://github.com/upmc-enterprises/registry-creds and AWS container registry.
|
|
Before I head off down a dead end, has anyone had experience trying a kubelet image credential provider with k3s? It's alpha but still, probably the future. |
|
Here is a quick snippet that will automate ecr login on k3s. Just bear in mind it will overwrite the registries.yaml file if you run it like it is. Make sure you set your AWS credentials variables. Does a lot of assumptions but you should get the idea. |
|
Has anyone tried $ aws ecr get-login-password --region <REGION> | nerdctl login --username AWS --password-stdin <AWS_ACCOUNT_ID>.dkr.ecr.<REGION>.amazonaws.com
Login Succeeded |
|
I've managed to configure this by having the kubelet use the ECR image credential provider. Here's how to do it:
wget https://github.com/dntosas/ecr-credential-provider/releases/download/v1.2.0/ecr-credential-provider-linux-amd64
chmod +x ecr-credential-provider-linux-amd64
mv ecr-credential-provider-linux-amd64 /usr/local/bin/ecr-credential-provider
mkdir -p /etc/rancher/k3s
tee /etc/rancher/k3s/ecr-credential-provider-config.yaml > /dev/null <<'EOF'
apiVersion: kubelet.config.k8s.io/v1
kind: CredentialProviderConfig
providers:
- name: ecr-credential-provider
matchImages:
- "*.dkr.ecr.*.amazonaws.com"
defaultCacheDuration: "12h"
apiVersion: credentialprovider.kubelet.k8s.io/v1
env:
- name: AWS_REGION
value: <AWS_REGION>
- name: AWS_ACCESS_KEY_ID
value: <AWS_ACCESS_KEY_ID>
- name: AWS_SECRET_ACCESS_KEY
value: <AWS_SECRET_ACCESS_KEY>
EOF
chmod 600 /etc/rancher/k3s/ecr-credential-provider-config.yamlInstalling k3s with kubelet args. These can be added to already-installed nodes by adding these arguments to the k3s service command. curl -sfL https://get.k3s.io | sh -s - \
--kubelet-arg="image-credential-provider-config=/etc/rancher/k3s/ecr-credential-provider-config.yaml" \
--kubelet-arg="image-credential-provider-bin-dir=/usr/local/bin" |
Uh oh!
There was an error while loading. Please reload this page.
We have a k3s cluster which is running on AWS ec2, we want to deploy containers into this cluster using images in our AWS ECR, is this possible ?
All reactions