kubernetes创建集群资源对象, pod服务一直处于ContainerCreating状态问题。
failed to “StartContainer” for “POD” with ErrImagePull
1.查看pods状态,一直处于ContainerCreating状态
1
2
3
|
[
root
@
SZ
-
V
-
L
-
K8S
~
]
# kubectl get pods
NAME
READY
STATUS
RESTARTS
AGE
nginx
-
pod
0
/
1
ContainerCreating
0
15h
|
2.查看pod资源的详细信息中的错信息提示
[root@SZ-V-L-K8S ~]# kubectl describe pod nginx-pod
1
2
3
4
|
Events
:
FirstSeen
LastSeen
Count
From
SubObjectPath
Type
Reason
Message
--
--
--
--
-
--
--
--
--
--
--
-
--
--
--
--
--
--
--
--
-
--
--
--
--
--
--
--
--
--
--
-
15h
4m
180
{
kubelet
srv
.node1
}
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)"
|
3.错误分析
错误提示: 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)”
大概出错意图是,srv.node1这个节点机,拉取Docker镜像的时候出错了,因为redhat-ca.crt这个证书文件不存在。
到srv.node1节点主机,手动执行拉取镜像试一下。
1
2
3
|
[
root
@
SZ
-
V
-
L
-
docker
-
node1
~
]
# docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest
Trying
to
pull
repository
registry
.access
.redhat
.com
/
rhel7
/
pod
-
infrastructure
.
.
.
open
/
etc
/
docker
/
certs
.d
/
registry
.access
.redhat
.com
/
redhat
-
ca
.crt
:
no
such
file
or
directory
|
错误信息一样的,查看下redhat-ca.crt这个证书文件目录是否存在
1
2
|
[
root
@
SZ
-
V
-
L
-
docker
-
node1
~
]
# ls -l /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt
lrwxrwxrwx
.
1
root
root
27
Apr
18
16
:
05
/
etc
/
docker
/
certs
.d
/
registry
.access
.redhat
.com
/
redhat
-
ca
.crt
->
/
etc
/
rhsm
/
ca
/
redhat
-
uep
.pem
|
是个软件链接到/etc/rhsm/ca/redhat-uep.pem这个文件,而且这个文件目录不存在。
问题找到了。
4.错误解决
跟rhsm这个有关,全称Red Hat Subscription Manager。 跟RedHat查关服务,直接用yum安装下rhsm相关的组件。
1
2
3
4
5
|
[
root
@
SZ
-
V
-
L
-
docker
-
node1
~
]
# yum install *rhsm*
Downloading
packages
:
(
1
/
3
)
:
python
-
rhsm
-
certificates
-
1.19.10
-
1.el7_4.x86_64.rpm
|
41
kB
00
:
00
:
00
(
2
/
3
)
:
python
-
dateutil
-
1.5
-
7.el7.noarch.rpm
|
85
kB
00
:
00
:
01
(
3
/
3
)
:
python
-
rhsm
-
1.19.10
-
1.el7_4.x86_64.rpm
|
再手动执行拉取镜像文件,现在可以拉取镜像文件了,问题解决。
1
2
3
4
|
[
root
@
SZ
-
V
-
L
-
docker
-
node1
~
]
# docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest
Trying
to
pull
repository
registry
.access
.redhat
.com
/
rhel7
/
pod
-
infrastructure
.
.
.
latest
:
Pulling
from
registry
.access
.redhat
.com
/
rhel7
/
pod
-
infrastructure
26e5ed6899db
:
Downloading
[
=
>
]
2.107
MB
/
74.87
MB
|
5.重新集群资源对象
返回到master主节点,删除集群资源对象再重新创建。
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[
root
@
ZSZ
-
V
-
L
-
K8S
~
]
# kubectl delete -f /data/app/docker_nginx/nginx-pod.yaml
pod
"nginx-pod"
deleted
[
root
@
SZ
-
V
-
L
-
K8S
~
]
# kubectl get pods
No
resources
found
.
[
root
@
SZ
-
V
-
L
-
K8S
~
]
# kubectl create -f /data/app/docker_nginx/nginx-pod.yaml
pod
"nginx-pod"
created
再查看下对应的节点是不是有拉取到对应的镜像文件。
[
root
@
SZ
-
V
-
L
-
docker
-
node1
~
]
# docker images
REPOSITORY
TAG
IMAGE
ID
CREATED
SIZE
registry
.access
.redhat
.com
/
rhel7
/
pod
-
infrastructure
latest
99965fb98423
6
months
ago
209
MB
|