Kubernetes pod ContainerCreating 的解决方法

使用 Kubernetes 创建完 pod 之后,查看 pods 状态,发现都处于 containercreationg 状态中。

kubectl get pods

输出结果:

查看其中的一个 pod 的状态:

kubectl describe pod mysql-jn6f2

报错信息显示:

Error syncing pod, skipping: failed to "StartContainer" for "POD" with ErrImagePull: "image pull failed for registry.access.redhat.com/rhel7/...。

 

1. 解决方案1

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

这两条命令会生成 /etc/rhsm/ca/redhat-uep.pem文件,其中使用 wget 下载文件的时候,可能需要多试几次。

rpm2cpio 和 cpio 用于从包中提取指定的文件。

注意必须是对每台机器都使用这个指令,然后就能获取到 certificate:

 

 

2. 解决方案2

install *rhsm*

安装完成后,执行命令:

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

输出以下结果:

[root@localhost]# docker pullregistry.access.redhat.com/rhel7/pod-infrastructure:latest
Trying to pull repositoryregistry.access.redhat.com/rhel7/pod-infrastructure ...
latest: Pulling fromregistry.access.redhat.com/rhel7/pod-infrastructure
26e5ed6899db: Pull complete
66dbe984a319: Pull complete
9138e7863e08: Pull complete
Digest:sha256:92d43c37297da3ab187fc2b9e9ebfb243c1110d446c783ae1b989088495db931
Status: Downloaded newer image forregistry.access.redhat.com/rhel7/pod-infrastructure:latest

3. 查看状态

kubectl get pods

 

1. 准备 k8s 环境[root@master yaml]# kubectl get nodes ##两个节点均为Ready状态NAME STATUS ROLES AGE VE ...