Docker pull rate request limit from Kubernetes environment

Viewed 73

I logged in using docker login command in my machine.

then I tried to run the kubectl command to apply a yaml file:

kubectl apply -f manifests/1_helloworld_deploy.yaml

but this failed with error :

Warning Failed 20s (x2 over 35s) kubelet Failed to pull image "nginx:latest": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/nginx:latest": failed to copy: httpReaderSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/nginx/manifests/sha256:89ea560b277f54022cf0b2e718d83a9377095333f8890e31835f615922071ddc: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit

Now, I already logged in using the docker username and account, still I'm getting a pull rate error.

What should I do to make this working for .yaml file also?

1 Answers
  • When you login to docker on a machine , its credentials will be saved in a file named ~/.docker/config.json
  • We need need to explicitly instruct these credentials to be used while pulling images .
  • For that we need to create a secret with contents of ~/.docker/config.json and mention that as imagePullSecrets in the yaml file.

Following is a sample procedure :

kubectl create secret docker-registry my-secret --from-file=.dockerconfigjson=/root/.docker/config.json

In the podspec update it as image pull secret as following :

apiVersion: v1
kind: Pod
metadata:
  name: boo
spec:
  containers:
    - name: boo
      image: busybox
  imagePullSecrets:
    - name: my-secret

Detailed Documentation

Related