使用Docker解决microK8s registry.k8s.io/pause:3.7镜像拉取失败问题

使用Docker解决microK8s registry.k8s.io/pause:3.7镜像拉取失败问题

1. 安装docker

apt update
apt install docker.io

2. 查找镜像

root@testk8s:/home/test/下载# docker search pause:3.7

NAME                 DESCRIPTION                      STARS     OFFICIAL   AUTOMATED
hongshixing/pause    fork from k8s.gcr.io/pause:3.7   0                 
qazwsxqwe123/pause   k8s.gcr.io/pause:3.7             0

3. 下载镜像

root@testk8s:/home/test/下载# docker image pull qazwsxqwe123/pause:3.7
3.7: Pulling from qazwsxqwe123/pause
7582c2cc65ef: Pull complete 
Digest: sha256:445a99db22e9add9bfb15ddb1980861a329e5dff5c88d7eec9cbf08b6b2f4eb1
Status: Downloaded newer image for qazwsxqwe123/pause:3.7
docker.io/qazwsxqwe123/pause:3.7

4. 输出镜像包

root@testk8s:/home/test/下载# docker image list
REPOSITORY           TAG       IMAGE ID       CREATED         SIZE
qazwsxqwe123/pause   3.7       221177c6082a   11 months ago   711kB

root@testk8s:/home/test/下载# docker image tag qazwsxqwe123/pause:3.7 registry.k8s.io/pause:3.7

root@testk8s:/home/test/下载# docker image list
REPOSITORY              TAG       IMAGE ID       CREATED         SIZE
qazwsxqwe123/pause      3.7       221177c6082a   11 months ago   711kB
registry.k8s.io/pause   3.7       221177c6082a   11 months ago   711kB

root@testk8s:/home/test/下载# docker save -o pause37.tar registry.k8s.io/pause
root@testk8s:/home/test/下载# ll
总用量 1424
drwxr-xr-x  2 test test   4096 28 11:31 ./
drwxr-xr-x 14 test test   4096 26 14:30 ../
-rw-------  1 root  root  721408 28 11:31 pause37.tar
-rwxr-xr-x  1 test test 721408 26 15:05 pause.tar*

5. 导入镜像

ctr image import pause37.tar

6. 重启microk8s

microk8s stop && microk8s start

7. 启动成功

root@testk8s:/home/test/下载# microk8s status
microk8s is running
high-availability: no
  datastore master nodes: 127.0.0.1:19001
  datastore standby nodes: none
addons:
  enabled:
    ha-cluster           # (core) Configure high availability on the current node
    helm                 # (core) Helm - the package manager for Kubernetes
    helm3                # (core) Helm 3 - the package manager for Kubernetes
  disabled:
    cert-manager         # (core) Cloud native certificate management
    community            # (core) The community addons repository
    dashboard            # (core) The Kubernetes dashboard
    dns                  # (core) CoreDNS
    gpu                  # (core) Automatic enablement of Nvidia CUDA
    host-access          # (core) Allow Pods connecting to Host services smoothly
    hostpath-storage     # (core) Storage class; allocates storage from host directory
    ingress              # (core) Ingress controller for external access
    kube-ovn             # (core) An advanced network fabric for Kubernetes
    mayastor             # (core) OpenEBS MayaStor
    metallb              # (core) Loadbalancer for your Kubernetes cluster
    metrics-server       # (core) K8s Metrics Server for API access to service metrics
    minio                # (core) MinIO object storage
    observability        # (core) A lightweight observability stack for logs, traces and metrics
    prometheus           # (core) Prometheus operator for monitoring and logging
    rbac                 # (core) Role-Based Access Control for authorisation
    registry             # (core) Private image registry exposed on localhost:32000
    storage              # (core) Alias to hostpath-storage add-on, deprecated