k8s在部署服务的时候出现pods状态为ImagePullBackOff
NAME READY STATUS RESTARTS AGE
frontend-56465cb4c6-r4kxz 0/1 ImagePullBackOff 0 9s
redis-master-884889466-9jzrt 0/1 ImagePullBackOff 0 30s
redis-slave-55c9767c85-t96nf 0/1 ImagePullBackOff 0 20s
查看一下日志`
[root@nginx guestbook]# kubectl logs frontend-56465cb4c6-r4kxz
Error from server (BadRequest): container "php-redis" in pod "frontend-56465cb4c6-r4kxz" is waiting to start: image can't be pulled
错误说镜像不能下载,查看一下镜像是不是错了
[root@k8s-node01 ~]# docker search redis-master
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
kubeguide/redis-master redis-master with "Hello World!" 33
镜像好像是对的。 那可能是网络问题,然后发现我节点是快照恢复的没有配置镜像源。 配置一下腾讯云的docker镜像
cat > /etc/docker/daemon.json << EOF
{
"registry-mirrors": ["https://mirror.ccs.tencentyun.com"]
}
EOF
再重新载入,重启docker
> EOF
systemctl daemon-reload
systemctl restart docker
然后再看发现pods已经再下载中了,过一会就可以了
[root@nginx guestbook]# kubectl get pods
NAME READY STATUS RESTARTS AGE
frontend-56465cb4c6-r4kxz 1/1 Running 0 9s
redis-master-884889466-9jzrt 1/1 Running 0 30s
redis-slave-55c9767c85-t96nf 1/1 Running 0 20s
|