分享 | 交流
让学习成为一种习惯

kubernetes pod卡在ContainerCreating状态的解决办法

[root@master ~]# kubectl run nginx –image=docker.io/nginx –replicas=1 –port=9000
deployment “nginx” created

[root@master ~]# kubectl get deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
nginx 1 1 1 0 1m

[root@master ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-2187705812-x5xqp 0/1 ContainerCreating 0 1m

[root@master ~]# kubectl describe pod nginx
Name: nginx-2187705812-x5xqp
Namespace: default
Node: node2/10.146.0.3
Start Time: Mon, 07 May 2018 08:08:27 +0000
Labels: pod-template-hash=2187705812
run=nginx
Status: Pending
IP:
Controllers: ReplicaSet/nginx-2187705812
Containers:
nginx:
Container ID:
Image: docker.io/nginx
Image ID:
Port: 9000/TCP
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Volume Mounts:
Environment Variables:
Conditions:
Type Status
Initialized True
Ready False
PodScheduled True
No volumes.
QoS Class: BestEffort
Tolerations:
Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
——— ——– —– —- ————- ——– —— ——-
16m 16m 1 {default-scheduler } Normal Scheduled Successfully assigned nginx-2187705812-x5xqp to node2
16m 25s 8 {kubelet node2} 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)”

16m 10s 69 {kubelet node2} 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\””

解决方案:

所有的node机器上安装下面软件,并且确保有docker基础镜像和应用镜像(基础镜像就是上面redhat的pod-infrastructure:latest)

[root@master ~]# yum install *rhsm*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.hmc.edu
* epel: mirrors.kernel.org
* extras: mirror.steadfast.net
* updates: mirror.web-ster.com
Resolving Dependencies
–> Running transaction check
—> Package python-rhsm.x86_64 0:1.19.10-1.el7_4 will be installed
–> Processing Dependency: python-dateutil for package: python-rhsm-1.19.10-1.el7_4.x86_64
—> Package python-rhsm-certificates.x86_64 0:1.19.10-1.el7_4 will be installed
–> Running transaction check
—> Package python-dateutil.noarch 0:1.5-7.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
Package Arch Version Repository Size
==========================================================================================
Installing:
python-rhsm x86_64 1.19.10-1.el7_4 updates 127 k
python-rhsm-certificates x86_64 1.19.10-1.el7_4 updates 41 k
Installing for dependencies:
python-dateutil noarch 1.5-7.el7 base 85 k

Transaction Summary
==========================================================================================
Install 2 Packages (+1 Dependent package)

Total download size: 253 k
Installed size: 723 k
Is this ok [y/d/N]: y
Downloading packages:
(1/3): python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm | 41 kB 00:00:00
(2/3): python-rhsm-1.19.10-1.el7_4.x86_64.rpm | 127 kB 00:00:00
(3/3): python-dateutil-1.5-7.el7.noarch.rpm | 85 kB 00:00:00
——————————————————————————————
Total 399 kB/s | 253 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python-rhsm-certificates-1.19.10-1.el7_4.x86_64 1/3
Installing : python-dateutil-1.5-7.el7.noarch 2/3
Installing : python-rhsm-1.19.10-1.el7_4.x86_64 3/3
Verifying : python-dateutil-1.5-7.el7.noarch 1/3
Verifying : python-rhsm-certificates-1.19.10-1.el7_4.x86_64 2/3
Verifying : python-rhsm-1.19.10-1.el7_4.x86_64 3/3

Installed:
python-rhsm.x86_64 0:1.19.10-1.el7_4 python-rhsm-certificates.x86_64 0:1.19.10-1.el7_4

Dependency Installed:
python-dateutil.noarch 0:1.5-7.el7

Complete!

手动下载镜像或者更改仓库源
[root@master ~]# docker pull nginx
Using default tag: latest
Trying to pull repository docker.io/library/nginx …
latest: Pulling from docker.io/library/nginx
f2aa67a397c4: Pull complete
3c091c23e29d: Pull complete
4a99993b8636: Pull complete
Digest: sha256:0fb320e2a1b1620b4905facb3447e3d84ad36da0b2c8aa8fe3a5a81d1187b884
Status: Downloaded newer image for docker.io/nginx:latest

[root@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: Pull complete
66dbe984a319: Pull complete
9138e7863e08: Pull complete
Digest: sha256:92d43c37297da3ab187fc2b9e9ebfb243c1110d446c783ae1b989088495db931
Status: Downloaded newer image for registry.access.redhat.com/rhel7/pod-infrastructure:latest

再开查看pod

[root@master ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-2187705812-q8sdp 1/1 Running 0 11s

已经是变成了正常的Running状态

未经允许不得转载:留时刻运维网 » kubernetes pod卡在ContainerCreating状态的解决办法

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

留时刻 - Linux系统教程,运维经验分享

加入我们给我留言