kops: kubelet cannot pull images when using ECR containerProxy asset repository
/kind bug
1. What kops version are you running? The command kops version, will display
this information.
Client version: 1.29.2 (git-v1.29.2)
2. What Kubernetes version are you running? kubectl version will print the
version if a cluster is running or provide the Kubernetes version specified as
a kops flag.
Server Version: v1.29.7
3. What cloud provider are you using? AWS
4. What commands did you run? What is the simplest way to reproduce this issue? We are configuring local image asset repository however we are running into an issue when trying to update the cluster. We have configured all the ECR private repositories as required.
- Enable
assets.containerProxyin the Cluster spec - Copy the image assets
kops get assets --copy - Update the cluster
kops update cluster - Rolling update the first control-plane node
kops rolling-update
5. What happened after the commands executed? New node fails to join the cluster and cluster validation fails.
Upon SSH’ing into the new node and checking the logs via journalctl -u kubelet.service we see that kubelet is unable to pull images from ECR:
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: I0820 05:41:26.005263 3267 util.go:30] "No sandbox for pod can be found. Need to start a new one" pod="kube-system/etcd-manager-events-i-0b9bd5da0497cb428"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: I0820 05:41:26.025018 3267 util.go:30] "No sandbox for pod can be found. Need to start a new one" pod="kube-system/etcd-manager-main-i-0b9bd5da0497cb428"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: I0820 05:41:26.053492 3267 util.go:30] "No sandbox for pod can be found. Need to start a new one" pod="kube-system/kube-apiserver-i-0b9bd5da0497cb428"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: E0820 05:41:26.077935 3267 remote_runtime.go:193] "RunPodSandbox from runtime service failed" err="rpc error: code = Unknown desc = failed to get sandbox image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull and unpack image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to resolve reference \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: E0820 05:41:26.078072 3267 kuberuntime_sandbox.go:72] "Failed to create sandbox for pod" err="rpc error: code = Unknown desc = failed to get sandbox image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull and unpack image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to resolve reference \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials" pod="kube-system/etcd-manager-events-i-0b9bd5da0497cb428"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: E0820 05:41:26.078174 3267 kuberuntime_manager.go:1182] "CreatePodSandbox for pod failed" err="rpc error: code = Unknown desc = failed to get sandbox image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull and unpack image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to resolve reference \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials" pod="kube-system/etcd-manager-events-i-0b9bd5da0497cb428"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: E0820 05:41:26.078784 3267 pod_workers.go:1298] "Error syncing pod, skipping" err="failed to \"CreatePodSandbox\" for \"etcd-manager-events-i-0b9bd5da0497cb428_kube-system(404a8513399b8f50110f57caceb4dff4)\" with CreatePodSandboxError: \"Failed to create sandbox for pod \\\"etcd-manager-events-i-0b9bd5da0497cb428_kube-system(404a8513399b8f50110f57caceb4dff4)\\\": rpc error: code = Unknown desc = failed to get sandbox image \\\"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\\\": failed to pull image \\\"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\\\": failed to pull and unpack image \\\"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\\\": failed to resolve reference \\\"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\\\": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials\"" pod="kube-system/etcd-manager-events-i-0b9bd5da0497cb428" podUID="404a8513399b8f50110f57caceb4dff4"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: E0820 05:41:26.084358 3267 remote_runtime.go:193] "RunPodSandbox from runtime service failed" err="rpc error: code = Unknown desc = failed to get sandbox image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull and unpack image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to resolve reference \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: E0820 05:41:26.084580 3267 kuberuntime_sandbox.go:72] "Failed to create sandbox for pod" err="rpc error: code = Unknown desc = failed to get sandbox image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull and unpack image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to resolve reference \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials" pod="kube-system/etcd-manager-main-i-0b9bd5da0497cb428"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: E0820 05:41:26.084647 3267 kuberuntime_manager.go:1182] "CreatePodSandbox for pod failed" err="rpc error: code = Unknown desc = failed to get sandbox image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull and unpack image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to resolve reference \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials" pod="kube-system/etcd-manager-main-i-0b9bd5da0497cb428"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: E0820 05:41:26.084885 3267 pod_workers.go:1298] "Error syncing pod, skipping" err="failed to \"CreatePodSandbox\" for \"etcd-manager-main-i-0b9bd5da0497cb428_kube-system(e6690dd45219e272fbb9992ff07f37b9)\" with CreatePodSandboxError: \"Failed to create sandbox for pod \\\"etcd-manager-main-i-0b9bd5da0497cb428_kube-system(e6690dd45219e272fbb9992ff07f37b9)\\\": rpc error: code = Unknown desc = failed to get sandbox image \\\"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\\\": failed to pull image \\\"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\\\": failed to pull and unpack image \\\"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\\\": failed to resolve reference \\\"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\\\": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials\"" pod="kube-system/etcd-manager-main-i-0b9bd5da0497cb428" podUID="e6690dd45219e272fbb9992ff07f37b9"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: E0820 05:41:26.086957 3267 remote_runtime.go:193] "RunPodSandbox from runtime service failed" err="rpc error: code = Unknown desc = failed to get sandbox image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull and unpack image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to resolve reference \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: E0820 05:41:26.087058 3267 kuberuntime_sandbox.go:72] "Failed to create sandbox for pod" err="rpc error: code = Unknown desc = failed to get sandbox image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull and unpack image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to resolve reference \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials" pod="kube-system/kube-apiserver-i-0b9bd5da0497cb428"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: E0820 05:41:26.087396 3267 kuberuntime_manager.go:1182] "CreatePodSandbox for pod failed" err="rpc error: code = Unknown desc = failed to get sandbox image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to pull and unpack image \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": failed to resolve reference \"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials" pod="kube-system/kube-apiserver-i-0b9bd5da0497cb428"
Aug 20 05:41:26 i-0b9bd5da0497cb428 kubelet[3267]: E0820 05:41:26.087529 3267 pod_workers.go:1298] "Error syncing pod, skipping" err="failed to \"CreatePodSandbox\" for \"kube-apiserver-i-0b9bd5da0497cb428_kube-system(bce2dccacc4b8ea6a460dcd7760b01ed)\" with CreatePodSandboxError: \"Failed to create sandbox for pod \\\"kube-apiserver-i-0b9bd5da0497cb428_kube-system(bce2dccacc4b8ea6a460dcd7760b01ed)\\\": rpc error: code = Unknown desc = failed to get sandbox image \\\"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\\\": failed to pull image \\\"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause:3.9@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\\\": failed to pull and unpack image \\\"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\\\": failed to resolve reference \\\"123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097\\\": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials\"" pod="kube-system/kube-apiserver-i-0b9bd5da0497cb428" podUID="bce2dccacc4b8ea6a460dcd7760b01ed"
6. What did you expect to happen? kubelet is able to pull images successfully from ECR.
7. Please provide your cluster manifest. Execute
kops get --name my.example.com -o yaml to display your cluster manifest.
You may want to remove your cluster name and other sensitive information.
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
name: k8s.example.com
spec:
api:
loadBalancer:
class: Classic
idleTimeoutSeconds: 3600
type: Internal
assets:
containerProxy: 123456789101.dkr.ecr.ap-southeast-2.amazonaws.com/k8s-example
fileRepository: https://example-k8s-assets.s3.ap-southeast-2.amazonaws.com/kops
authentication: {}
authorization:
rbac: {}
certManager:
enabled: true
channel: stable
cloudProvider: aws
...
containerRuntime: containerd
...
iam:
allowContainerRegistry: true
legacy: false
useServiceAccountExternalPermissions: true
kubeAPIServer:
authorizationMode: Node,RBAC
...
kubelet:
anonymousAuth: false
authenticationTokenWebhook: true
authorizationMode: Webhook
evictionHard: memory.available<10%,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
kubernetesVersion: 1.29.7
networking:
calico:
crossSubnet: true
mtu: 8912
nodeTerminationHandler:
enabled: false
nonMasqueradeCIDR: 100.64.0.0/10
podIdentityWebhook:
enabled: true
serviceAccountIssuerDiscovery:
discoveryStore: s3://example-k8s-oidc
enableAWSOIDCProvider: true
...
8. Please run the commands with most verbose logging by adding the -v 10 flag.
Paste the logs into this report, or in a gist and provide the gist link here.
9. Anything else do we need to know? The kubelet log shows that the image credential provider flags are being passed:
Aug 20 05:41:25 i-0b9bd5da0497cb428 kubelet[3267]: I0820 05:41:25.120555 3267 flags.go:64] FLAG: --image-credential-provider-bin-dir="/usr/local/bin"
Aug 20 05:41:25 i-0b9bd5da0497cb428 kubelet[3267]: I0820 05:41:25.120563 3267 flags.go:64] FLAG: --image-credential-provider-config="/var/lib/kubelet/credential-provider.conf"
The ecr-credential-provider binary exists at the location passed to kubelet:
ubuntu@i-0b9bd5da0497cb428:~$ ls -l /usr/local/bin/
total 252944
-rwxr-xr-x 1 root root 55331649 Aug 20 05:39 crictl
-rwxr-xr-x 1 root root 15863808 Aug 20 05:39 ecr-credential-provider
-rwxr-xr-x 1 root root 50225304 Aug 20 05:39 kubectl
-rwxr-xr-x 1 root root 112570628 Aug 20 05:39 kubelet
-rwxr-xr-x 1 root root 25010176 Aug 20 05:39 nerdctl
The credential provider config exists at the location passed to kubelet (and looks valid):
ubuntu@i-0b9bd5da0497cb428:~$ cat /var/lib/kubelet/credential-provider.conf
apiVersion: kubelet.config.k8s.io/v1
kind: CredentialProviderConfig
providers:
- name: ecr-credential-provider
matchImages:
- "*.dkr.ecr.*.amazonaws.com"
- "*.dkr.ecr.*.amazonaws.com.cn"
- "*.dkr.ecr-fips.*.amazonaws.com"
- "*.dkr.ecr.us-iso-east-1.c2s.ic.gov"
- "*.dkr.ecr.us-isob-east-1.sc2s.sgov.gov"
defaultCacheDuration: "12h"
apiVersion: credentialprovider.kubelet.k8s.io/v1
args:
- get-credentials
Seems like a similar issue as kubernetes/kops#13494 however there was no clear resolution in that issue (and we are not using the AWS China partition).
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 18 (14 by maintainers)
The easiest workaround is to call the credential helper directly and pass the credentials to crictl and pull the image, as suggested here: https://github.com/containerd/containerd/issues/6637#issuecomment-1061965828
Bottlerocket does the same: https://github.com/bottlerocket-os/bottlerocket/pull/382
You might be able to do this with additionalUserData but need to ensure it runs after containerd is running, so it may take adding a systemd service that depends on containerd.
A long term solution would be for kops’ nodeup to pull the
podInfraContainerImageexplicitly whenevercontainerProxyis set.