Kubernetes出现pods服务一直处于ContainerCreating状态
创建单机Kubenetes集群环境后,Pod一直处于ContainerCreating状态:
[root@VM_0_3_centos]# kubectl get podsNAME READY STATUS RESTARTS AGEmyweb-pgn80 0/1 ContainerCreating 0 10m查看Pod的Event记录
[root@VM_0_3_centos]# kubectl describe pod myweb-pgn80无法创建的原因提示:
Error syncing pod, skipping: failed to "StartContainer" for "POD" with ErrImagePull: "image pull failed for registry.access.redhat.com/rhel7/pod-infrastructure:latest, this may be because there are no credentials on this request. details: (open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory)"查找缺失的文件,显示是一个软连接,链接目标是/etc/rhsm:
[root@VM_0_3_centos conf.d]# ll /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crtlrwxrwxrwx 1 root root 27 Jun 10 11:37 /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt -> /etc/rhsm/ca/redhat-uep.pem尝试手动拉取镜像
[root@VM_0_3_centos]# docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest提示:
open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory依据google的解决办法,尝试使用
[root@VM_0_3_centos]# yum install *rhsm*Loaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfilePackage python-rhsm-1.19.10-1.el7_4.x86_64 is obsoleted by subscription-manager-rhsm-1.20.11-1.el7.centos.x86_64 which is already installedPackage subscription-manager-rhsm-1.20.11-1.el7.centos.x86_64 already installed and latest versionPackage python-rhsm-certificates-1.19.10-1.el7_4.x86_64 is obsoleted by subscription-manager-rhsm-certificates-1.20.11-1.el7.centos.x86_64 which is already installedPackage subscription-manager-rhsm-certificates-1.20.11-1.el7.centos.x86_64 already installed and latest versionNothing to do问题出在目标的两个包被subscription-manager-rhsm-certificates-1.20.11-1.el7.centos.x86_64 和subscription-manager-rhsm-1.20.11-1.el7.centos.x86_64替代。
删除已经安装的这两个包,手动安装目标包
[root@VM_0_3_centos]# yum remove *rhsm*下载目标包,注意版本
#wget ftp://ftp.icm.edu.pl/vol/rzm6/linux-scientificlinux/7.4/x86_64/os/Packages/python-rhsm-certificates-1.19.9-1.el7.x86_64.rpm#wget ftp://ftp.icm.edu.pl/vol/rzm6/linux-scientificlinux/7.4/x86_64/os/Packages/python-rhsm-1.19.9-1.el7.x86_64.rpm然后执行安装命令
[root@VM_0_3_centos centos]# rpm -ivh *.rpmwarning: python-rhsm-1.19.9-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEYPreparing... ################################# [100%]Updating / installing... 1:python-rhsm-certificates-1.19.9-1################################# [ 50%] 2:python-rhsm-1.19.9-1.el7 ################################# [100%]重新拉取镜像
[root@VM_0_3_centos centos]#docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest查看POD状态
[root@VM_0_3_centos centos]# kubectl get podsNAME READY STATUS RESTARTS AGEmysql-m4n1g 1/1 Running 0 9hmyweb-pgn80 1/1 Running 0 9hmyweb-z7q4v 1/1 Running 0 9h解决问题