kubernetes创建yaml,pod服务一直处于 ContainerCreating状态的原因查找与解决

通过yaml 成功创建了 pod ,但是运行状态一直显示为 ContainerCreating 而不是 Running

[root@localhost k8s_work]# kubectl get pods
NAME          READY     STATUS              RESTARTS   AGE
myweb-tn33   0/1       ContainerCreating   0          9m
myweb-36k56   0/1       ContainerCreating   0          1h
myweb-65ct6   0/1       ContainerCreating   0          1h

通过 kubectl describe pod myweb-tn33 命令发现了问题

Events:
  FirstSeen	LastSeen	Count	From			SubObjectPath	Type		Reason		Message
  ---------	--------	-----	----			-------------	--------	------		-------
  37s		37s		1	{default-scheduler }			Normal		Scheduled	Successfully assigned mysql-mf2mb to 127.0.0.1
  37s		22s		2	{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)"

  8s	8s	1	{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\""

在下载 registry.access.redhat.com/rhel7/pod-infrastructure:latest 可是没下下来,
于是我进行了手动下载

[root@localhost registry.access.redhat.com]# 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

还是存在问题,显示目录找不到,而问题还是有镜像没有下下来

解决方案

于是我修改了/etc/kubernetes/kubelet 文件

#KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"
#修改为: 
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=docker.io/kubernetes/pause:latest"

青冥有晓月

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐