安装Kubernetes遇到的问题

初次安装Kubernetes后,尝试nginx,服务启动成功,但是nginx不能访问,通过下面的命令查看日志:

journalctl -u kubelet -f

发现有:

Error syncing pod 39931f84-dd24-11e8-b766-000c294dd3a2, skipping: failed to “StartContainer” for “POD” with ImagePullBackOff: “Back-off pulling image \”registry.access.redhat.com/rhel7/pod-infrastructure:latest\”

应该是无法下载 pod-infrastructure:latest

手工执行命令:

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

看来是缺证书,执行如下两条命令,生成证书:

wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm

rpm2cpio python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm | cpio -iv –to-stdout ./etc/rhsm/ca/redhat-uep.pem | tee /etc/rhsm/ca/redhat-uep.pem

再次执行命令:

docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest

成功。

Nginx访问自动恢复正常。