欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

no such file or directory

程序员文章站 2022-03-08 19:29:03
...

pod启动一分钟了 还是出去未创建的状态,发现是无法下载镜像,

[[email protected] pod]# kubectl get pod
NAME      READY     STATUS              RESTARTS   AGE
nginx     0/1       ContainerCreating   0          1m
[[email protected] pod]# kubectl describe pod nginx

  FirstSeen	LastSeen	Count	From			SubObjectPath	Type   Reason		Message
  ---------	--------	-----	----			-------------	-------------		-------
  2m		2m		1	{default-scheduler }			Normal Scheduled	Successfully assigned nginx to 10.0.0.63
  2m		37s		4	{kubelet 10.0.0.63}			WarningFailedSync	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)"

  1m	11s	6	{kubelet 10.0.0.63}		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\""

我们去节点上手动拉取镜像 试一试:也是不行的

[[email protected] ~]# docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latestTrying 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

我百度了一下
https://cloud.tencent.com/developer/article/1156329

我们现在不需要去更改
更改下载镜像的地址为私有仓库的地址

[[email protected] ~]# vim /etc/kubernetes/kubelet 
#这里指定地址  是从红帽官方去pull的 
# pod infrastructure container
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel
7/pod-infrastructure:latest"

把这个地址 改成私有仓库地址 ,就可以从私有仓库pull了

docker search ylmcr7/pod-infrastructure:latest
docker tag ylmcr7/pod-infrastructure:latest 10.0.0.61:5000/pod-infrastructure:latest


[[email protected] ~]# vim /etc/kubernetes/kubelet 
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=10.0.0.61:5000/pod-infrastructure:latest"

systemctl restart kubelet.service
[[email protected] pod]# kubectl get pod
NAME      READY     STATUS    RESTARTS   AGE
nginx     1/1       Running   0          23m