pod启动一分钟了 还是出去未创建的状态,发现是无法下载镜像,
[root@k8s-m01 pod]# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx 0/1 ContainerCreating 0 1m
[root@k8s-m01 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\""
我们去节点上手动拉取镜像 试一试:也是不行的
[root@k8s-m03 ~]# 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
我们现在不需要去更改
更改下载镜像的地址为私有仓库的地址
[root@k8s-m03 ~]# 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
[root@k8s-m03 ~]# vim /etc/kubernetes/kubelet
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=10.0.0.61:5000/pod-infrastructure:latest"
systemctl restart kubelet.service
[root@k8s-m01 pod]# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx 1/1 Running 0 23m