记录k8s中部署dashboard报错ImagePullBackOff

查看container服务日志信息,提示无法拉取k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1这个镜像。考虑手动拉取镜像。

root@czx-virtual-machine:/# systemctl status containerd.service
● containerd.service - containerd container runtime
   Loaded: loaded (/lib/systemd/system/containerd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2024-05-17 11:26:28 CST; 8min ago
     Docs: https://containerd.io
  Process: 115685 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
 Main PID: 115686 (containerd)
    Tasks: 83
   CGroup: /system.slice/containerd.service
           ├─ 87866 /usr/bin/containerd-shim-runc-v2 -namespace k8s.io -id 69c3e72ad69388da2d4bcf5cce893ddc2853fa223716c2ba4c506508c207a897 -address /run/containerd/containerd.sock
           ├─ 87876 /usr/bin/containerd-shim-runc-v2 -namespace k8s.io -id 7d055076de6fd00f82b512e63ef090b800bb24a211726d5a81ecb5aacbafbf51 -address /run/containerd/containerd.sock
           ├─ 88984 /usr/bin/containerd-shim-runc-v2 -namespace k8s.io -id d8650c9056a219b50b8602153124805d030cdbd302094a812226984463a6f116 -address /run/containerd/containerd.sock
           ├─ 88996 /usr/bin/containerd-shim-runc-v2 -namespace k8s.io -id b44f70c301d37370e2673ff1ce1b5844ec58d74f5d126d8433384915677ddeac -address /run/containerd/containerd.sock
           ├─ 89019 /usr/bin/containerd-shim-runc-v2 -namespace k8s.io -id 44e76e2f079e76caaf53b801da3b8ba702e39246e531e26cf3e6616352bddebc -address /run/containerd/containerd.sock
           ├─ 98166 /usr/bin/containerd-shim-runc-v2 -namespace k8s.io -id c877744656b9b5f546a994476e8e9e084fb7179eba2b6afac3a142d4202526e1 -address /run/containerd/containerd.sock
           └─115686 /usr/bin/containerd

5月 17 11:29:48 k8s-node2 containerd[115686]: time="2024-05-17T11:29:48.039325879+08:00" level=info msg="trying next host" error="failed to do request: Head \"https://k8s.gcr.io/v2/kubernetes-dashboard-amd64/manifests/v1.10.1\": dial tcp 142.2
5月 17 11:29:48 k8s-node2 containerd[115686]: time="2024-05-17T11:29:48.039819132+08:00" level=error msg="PullImage \"k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1\" failed" error="failed to pull and unpack image \"k8s.gcr.io/kubernetes-dashbo
5月 17 11:31:21 k8s-node2 containerd[115686]: time="2024-05-17T11:31:21.022586595+08:00" level=info msg="PullImage \"k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1\""
5月 17 11:31:42 k8s-node2 containerd[115686]: time="2024-05-17T11:31:42.040689375+08:00" level=info msg="trying next host" error="failed to do request: Head \"https://k8s.gcr.io/v2/kubernetes-dashboard-amd64/manifests/v1.10.1\": dial tcp 142.2
5月 17 11:31:42 k8s-node2 containerd[115686]: time="2024-05-17T11:31:42.041532628+08:00" level=error msg="PullImage \"k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1\" failed" error="failed to pull and unpack image \"k8s.gcr.io/kubernetes-dashbo
5月 17 11:34:29 k8s-node2 containerd[115686]: time="2024-05-17T11:34:29.021759187+08:00" level=info msg="PullImage \"k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1\""
5月 17 11:34:50 k8s-node2 containerd[115686]: time="2024-05-17T11:34:50.038493794+08:00" level=info msg="trying next host" error="failed to do request: Head \"https://k8s.gcr.io/v2/kubernetes-dashboard-amd64/manifests/v1.10.1\": dial tcp 142.2
5月 17 11:34:50 k8s-node2 containerd[115686]: time="2024-05-17T11:34:50.038987933+08:00" level=error msg="PullImage \"k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1\" failed" error="failed to pull and unpack image \"k8s.gcr.io/kubernetes-dashbo
5月 17 11:34:57 k8s-node2 containerd[115686]: time="2024-05-17T11:34:57.010082638+08:00" level=info msg="No cni config template is specified, wait for other system components to drop the config."
5月 17 11:34:58 k8s-node2 containerd[115686]: time="2024-05-17T11:34:58.185871447+08:00" level=info msg="PullImage \"k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1\""

手动拉取镜像超时,说明这个镜像源用不了,尝试换一个

修改kubernetes-dashboard.yaml 文件,将kubernetes-dashboard容器镜像来源改为 mirrorgooglecontainers/kubernetes-dashboard-amd64:v1.10.0。

root@ubt:/# vi kubernetes-dashboard.yaml 

更新

root@ubt:/# kubectl apply -f kubernetes-dashboard.yaml
secret/kubernetes-dashboard-certs unchanged
serviceaccount/kubernetes-dashboard unchanged
role.rbac.authorization.k8s.io/kubernetes-dashboard-minimal unchanged
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard-minimal unchanged
deployment.apps/kubernetes-dashboard configured
service/kubernetes-dashboard unchanged

查看pod信息,能观察到在node1节点新创建了一个dashboard

root@ubt:/# kubectl get pod --all-namespaces -o wide
NAMESPACE      NAME                                    READY   STATUS              RESTARTS   AGE    IP                NODE        NOMINATED NODE   READINESS GATES
default        my-nginx-g5vvt                          1/1     Running             0          18h    10.244.4.2        k8s-node2   <none>           <none>
default        my-nginx-nfljp                          1/1     Running             0          18h    10.244.5.3        k8s-node1   <none>           <none>
default        my-nginx-qg55n                          1/1     Running             0          18h    10.244.5.2        k8s-node1   <none>           <none>
default        my-nginx-rwwq7                          1/1     Running             0          18h    10.244.4.4        k8s-node2   <none>           <none>
default        my-nginx-sf96w                          1/1     Running             0          18h    10.244.5.4        k8s-node1   <none>           <none>
default        my-nginx-v7bhq                          1/1     Running             0          18h    10.244.4.3        k8s-node2   <none>           <none>
kube-flannel   kube-flannel-ds-p7bcq                   1/1     Running             0          18h    192.168.145.130   k8s-node2   <none>           <none>
kube-flannel   kube-flannel-ds-qmcvl                   1/1     Running             0          19h    192.168.145.128   ubt         <none>           <none>
kube-flannel   kube-flannel-ds-xnl6f                   1/1     Running             0          18h    192.168.145.129   k8s-node1   <none>           <none>
kube-system    coredns-66f779496c-hbm25                1/1     Running             0          19h    10.244.0.2        ubt         <none>           <none>
kube-system    coredns-66f779496c-mwtdz                1/1     Running             0          19h    10.244.0.3        ubt         <none>           <none>
kube-system    etcd-ubt                                1/1     Running             2          19h    192.168.145.128   ubt         <none>           <none>
kube-system    kube-apiserver-ubt                      1/1     Running             2          19h    192.168.145.128   ubt         <none>           <none>
kube-system    kube-controller-manager-ubt             1/1     Running             2          19h    192.168.145.128   ubt         <none>           <none>
kube-system    kube-proxy-57swn                        1/1     Running             0          18h    192.168.145.129   k8s-node1   <none>           <none>
kube-system    kube-proxy-b26vg                        1/1     Running             0          18h    192.168.145.130   k8s-node2   <none>           <none>
kube-system    kube-proxy-r5stv                        1/1     Running             0          19h    192.168.145.128   ubt         <none>           <none>
kube-system    kube-scheduler-ubt                      1/1     Running             2          19h    192.168.145.128   ubt         <none>           <none>
kube-system    kubernetes-dashboard-57c76df9b5-r8fj8   0/1     ContainerCreating   0          106s   <none>            k8s-node1   <none>           <none>
kube-system    kubernetes-dashboard-5b7fdc85bd-ljc8x   0/1     ErrImagePull        0          17h    10.244.4.6        k8s-node2   <none>           <none>

切换至node1节点服务器,重启containerd服务

root@czx-virtual-machine:/# systemctl restart containerd
root@czx-virtual-machine:/# systemctl status containerd.service
● containerd.service - containerd container runtime
   Loaded: loaded (/lib/systemd/system/containerd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2024-05-17 11:36:50 CST; 1s ago
     Docs: https://containerd.io
  Process: 124741 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
 Main PID: 124742 (containerd)
    Tasks: 83
   CGroup: /system.slice/containerd.service
           ├─ 56926 /usr/bin/containerd-shim-runc-v2 -namespace k8s.io -id 463c5132faa03d4e52638da4a144ef898789b230580f2879f93c6cd140e733e4 -address /run/containerd/containerd.sock
           ├─ 56942 /usr/bin/containerd-shim-runc-v2 -namespace k8s.io -id cd1b9a68335ebdd7c1a5c1edd52b5a0adf7f1b1284e5151543a82a796ce9acbe -address /run/containerd/containerd.sock
           ├─ 58592 /usr/bin/containerd-shim-runc-v2 -namespace k8s.io -id 53a1a0ce2ae7bf7fa7ca8fe5ec516b6a3c8eaa138cc9d011105f2798a5ba90b1 -address /run/containerd/containerd.sock
           ├─ 58602 /usr/bin/containerd-shim-runc-v2 -namespace k8s.io -id 72d668efd43b3f0117b6badb6d752e9fccfffeb3436d6ebc9bb3055bc4f9b6d9 -address /run/containerd/containerd.sock
           ├─ 58615 /usr/bin/containerd-shim-runc-v2 -namespace k8s.io -id 2f847b771c979203bd93457e9bd4c5f9bd410f28567d94794d837816e3fd8ff5 -address /run/containerd/containerd.sock
           ├─123891 /usr/bin/containerd-shim-runc-v2 -namespace k8s.io -id 6b3c55c92ade2594459aa8c1771614403ce1a6771435d42f4890443f1e20babd -address /run/containerd/containerd.sock
           └─124742 /usr/bin/containerd

5月 17 11:36:50 k8s-node1 containerd[124742]: time="2024-05-17T11:36:50.551421221+08:00" level=info msg="Get image filesystem path \"/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs\""
5月 17 11:36:50 k8s-node1 containerd[124742]: time="2024-05-17T11:36:50.589513544+08:00" level=info msg=serving... address=/run/containerd/containerd.sock.ttrpc
5月 17 11:36:50 k8s-node1 containerd[124742]: time="2024-05-17T11:36:50.589499529+08:00" level=info msg="Start subscribing containerd event"
5月 17 11:36:50 k8s-node1 containerd[124742]: time="2024-05-17T11:36:50.589567099+08:00" level=info msg=serving... address=/run/containerd/containerd.sock
5月 17 11:36:50 k8s-node1 containerd[124742]: time="2024-05-17T11:36:50.589578048+08:00" level=info msg="Start recovering state"
5月 17 11:36:50 k8s-node1 containerd[124742]: time="2024-05-17T11:36:50.591177158+08:00" level=info msg="containerd successfully booted in 0.177865s"
5月 17 11:36:50 k8s-node1 containerd[124742]: time="2024-05-17T11:36:50.987140503+08:00" level=info msg="Start event monitor"
5月 17 11:36:50 k8s-node1 containerd[124742]: time="2024-05-17T11:36:50.987206502+08:00" level=info msg="Start snapshots syncer"
5月 17 11:36:50 k8s-node1 containerd[124742]: time="2024-05-17T11:36:50.987219458+08:00" level=info msg="Start cni network conf syncer for default"
5月 17 11:36:50 k8s-node1 containerd[124742]: time="2024-05-17T11:36:50.987228158+08:00" level=info msg="Start streaming server"

若是还报错,手动拉取该镜像

root@czx-virtual-machine:/# docker pull mirrorgooglecontainers/kubernetes-dashboard-amd64:v1.10.0
v1.10.0: Pulling from mirrorgooglecontainers/kubernetes-dashboard-amd64
d66237a56abc: Pull complete 
Digest: sha256:e4b764fa9df0a30c467e7cec000920ea69dcc2ba8a9d0469ffbf1881a9614270
Status: Downloaded newer image for mirrorgooglecontainers/kubernetes-dashboard-amd64:v1.10.0
docker.io/mirrorgooglecontainers/kubernetes-dashboard-amd64:v1.10.0
root@czx-virtual-machine:/# docker images
REPOSITORY                                          TAG       IMAGE ID       CREATED       SIZE
mirrorgooglecontainers/kubernetes-dashboard-amd64   v1.10.0   0dab2435c100   5 years ago   122MB

最后在master服务器查看pod信息,状态为running

root@ubt:/# kubectl get pod --all-namespaces -o wide
NAMESPACE      NAME                                    READY   STATUS    RESTARTS   AGE    IP                NODE        NOMINATED NODE   READINESS GATES
default        my-nginx-g5vvt                          1/1     Running   0          18h    10.244.4.2        k8s-node2   <none>           <none>
default        my-nginx-nfljp                          1/1     Running   0          18h    10.244.5.3        k8s-node1   <none>           <none>
default        my-nginx-qg55n                          1/1     Running   0          18h    10.244.5.2        k8s-node1   <none>           <none>
default        my-nginx-rwwq7                          1/1     Running   0          18h    10.244.4.4        k8s-node2   <none>           <none>
default        my-nginx-sf96w                          1/1     Running   0          18h    10.244.5.4        k8s-node1   <none>           <none>
default        my-nginx-v7bhq                          1/1     Running   0          18h    10.244.4.3        k8s-node2   <none>           <none>
kube-flannel   kube-flannel-ds-p7bcq                   1/1     Running   0          18h    192.168.145.130   k8s-node2   <none>           <none>
kube-flannel   kube-flannel-ds-qmcvl                   1/1     Running   0          19h    192.168.145.128   ubt         <none>           <none>
kube-flannel   kube-flannel-ds-xnl6f                   1/1     Running   0          18h    192.168.145.129   k8s-node1   <none>           <none>
kube-system    coredns-66f779496c-hbm25                1/1     Running   0          19h    10.244.0.2        ubt         <none>           <none>
kube-system    coredns-66f779496c-mwtdz                1/1     Running   0          19h    10.244.0.3        ubt         <none>           <none>
kube-system    etcd-ubt                                1/1     Running   2          19h    192.168.145.128   ubt         <none>           <none>
kube-system    kube-apiserver-ubt                      1/1     Running   2          19h    192.168.145.128   ubt         <none>           <none>
kube-system    kube-controller-manager-ubt             1/1     Running   2          19h    192.168.145.128   ubt         <none>           <none>
kube-system    kube-proxy-57swn                        1/1     Running   0          18h    192.168.145.129   k8s-node1   <none>           <none>
kube-system    kube-proxy-b26vg                        1/1     Running   0          18h    192.168.145.130   k8s-node2   <none>           <none>
kube-system    kube-proxy-r5stv                        1/1     Running   0          19h    192.168.145.128   ubt         <none>           <none>
kube-system    kube-scheduler-ubt                      1/1     Running   2          19h    192.168.145.128   ubt         <none>           <none>
kube-system    kubernetes-dashboard-57c76df9b5-r8fj8   1/1     Running   0          3m1s   10.244.5.5        k8s-node1   <none>           <none>

尝试访问,成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值