Pod 一直处于 ContainerCreating 或状态
问题:查询pod处于ContainerCreating状态
[root@test]# kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-664452237-1cv55 0/1 ContainerCreating 0 20d
[root@test]# kubectl logs nginx-664452237-1cv55
Error from server (BadRequest): container "nginx" in pod "nginx-664452237-1cv55" is waiting to start: ContainerCreating
排查:输出pod详细信息
kubectl describe pod nginx-664452237-1cv55
Name: nginx-664452237-1cv55
Namespace: default
Node: 127.0.0.1/127.0.0.1
Start Time: Wed, 26 Jan 2022 17:26:53 +0800
Labels: pod-template-hash=664452237
run=nginx
Status: Pending
IP:
Controllers: ReplicaSet/nginx-664452237
Containers:
nginx:
Container ID:
Image: nginx:latest
Image ID:
Port: 80/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
--------- -------- ----- ---- ------------- -------- ------ -------
2h 56s 33 {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)"
2h 6s 637 {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\""
发现缺少/etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt
解决:
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
重启docker
systemctl restart docker
查看pod
[root@test]# kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-664452237-1cv55 1/1 Running 0 20d

浙公网安备 33010602011771号