默认的registry-1.docker.io被限制次数,搞的好烦

k8s 1.24 之后默认是不支持docker的,用containerd做实验,拉取镜像多次失败及被限制

FATA[0011] pulling image: rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/kubesphere/pause:3.8": failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/kubesphere/pause/manifests/sha256:9001185023633d17a2f98ff69b6ff2615b8ea02a825adffa40422f51dfdcde9d: 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: Process exited with status 1

failed: [node3] [PullImages] exec failed after 3 retries: pull image failed: Failed to exec command: sudo -E /bin/bash -c "env PATH=$PATH crictl pull kubesphere/pause:3.8 --platform amd64" 

E1020 15:39:38.279989   18564 remote_image.go:238] "PullImage from image service failed" err="rpc error: code = Unknown desc = failed to pull and unpack image \"docker.io/kubesphere/pause:3.8\": failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/kubesphere/pause/manifests/sha256:9001185023633d17a2f98ff69b6ff2615b8ea02a825adffa40422f51dfdcde9d: 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" image="kubesphere/pause:3.8"

containerd 加速配置_docker

用ansible-playbook写了个脚本,批量替换

cat containerd_setup.yml
---
- hosts: u7
  become: true
  tasks:
    - name: Add mirror repositories to containerd config
      lineinfile:
        path: /etc/containerd/config.toml
        regexp: '^\s*endpoint\s*=\s*\["https://registry-1.docker.io"\]'
        line: '          endpoint = ["https://dockerproxy.com", "https://docker.m.daocloud.io", "https://docker.mirrors.sjtug.sjtu.edu.cn", "https://docker.nju.edu.cn", "http://hub-mirror.c.163.com"]'
        state: present

单机的就直接修改 /etc/containerd/config.toml

          endpoint = ["https://registry-1.docker.io", "https://mirror.baidubce.com", "https://docker.mirrors.sjtug.sjtu.edu.cn", "https://docker.nju.edu.cn", "http://hub-mirror.c.163.com"]