1、获取pod信息
[root@izwz98e5znt7xgdg8aj0cfz ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
redis-master-c9gzd 0/1 ContainerCreating 0 17m
2、查看pod events
[root@izwz98e5znt7xgdg8aj0cfz ~]# kubectl describe pod redis-master-c9gzd
Name: redis-master-c9gzd
Namespace: default
Node: 127.0.0.1/127.0.0.1
Start Time: Sun, 05 Aug 2018 10:35:18 +0800
Labels: name=redis-master
Status: Pending
IP:
Controllers: ReplicationController/redis-master
Containers:
master:
Container ID:
Image: kubeguide/redis-master
Image ID:
Port: 6379/TCP
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Volume Mounts: <none>
Environment Variables: <none>
Conditions:
Type Status
Initialized True
Ready False
PodScheduled True
No volumes.
QoS Class: BestEffort
Tolerations: <none>
Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
17m 17m 1 {default-scheduler } Normal Scheduled Successfully assigned redis-master-c9gzd to 127.0.0.1
17m 1m 8 {kubelet 127.0.0.1} Warning FailedSync 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)"
17m 8s 74 {kubelet 127.0.0.1} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "POD" with ImagePullBackOff: "Back-off pulling image \"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,导致docker拉取pause镜像失败
3、查看redhat-ca.crt,发现是一个软连接,且该软连接对应的文件[root@izwz98e5znt7xgdg8aj0cfz ~]# ll /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt
lrwxrwxrwx 1 root root 27 Aug 4 07:12 /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt -> /etc/rhsm/ca/redhat-uep.pem
4、在网上找了该问题的处理方法,安装rhsm相关的库:yum install rhsm
安装完成后,执行一下docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest
如果依然报错,可参考下面的方法:
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文件.
5、再次查看/etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt文件
[root@izwz98e5znt7xgdg8aj0cfz Guestbook]# ll /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt
lrwxrwxrwx 1 root root 27 Aug 4 07:12 /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt -> /etc/rhsm/ca/redhat-uep.pem
[root@izwz98e5znt7xgdg8aj0cfz Guestbook]# ll /etc/rhsm/ca/redhat-uep.pem
-rw-r--r-- 1 root root 7732 Aug 5 11:00 /etc/rhsm/ca/redhat-uep.pem
发现文件/etc/rhsm/ca/redhat-uep.pem已经生成
6、此时再查看pod,已是running状态
[root@izwz98e5znt7xgdg8aj0cfz Guestbook]# kubectl get pod
NAME READY STATUS RESTARTS AGE
redis-master-rbc3k 1/1 Running 0 25s
至此,docker拉取pause镜像失败的问题得到解决