kubectl get pods 一直显示正在创建中
NAME READY STATUS RESTARTS AGE
nginx 0/1 ContainerCreating 0 2m

解决办法
查看原因:
kubectl describe pods

报错分析
因为在redhat官网上下载是需要证书认证的

++++++++++++++++++++++++++++++
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)”

3m 6s 16 {kubelet 10.0.0.13} 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””
+++++++++++++++++++++++++++++

解决:
master: 上传准备好的容器为本地register (pod-infrastructure-latest.tar.gz)
软件地址:
链接:https://pan.baidu.com/s/10iDjlTpuYrN-3kjX0AZblQ
提取码:zndw

1.在master节点:
[root@master test]# docker load -i pod-infrastructure-latest.tar.gz
[root@master test]# docker images
[root@master test]#docker tag docker.io/tianyebj/pod-infrastructure:latest 10.0.0.11:5000/lbz/pod-infrastructure:latest
[root@master test]# docker images
[root@master test]# docker push 10.0.0.11:5000/lbz/pod-infrastructure:latest

2.在所有node节点:
[root@master test]#vim /etc/kubernetes/kubelet
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=10.0.0.11:5000/lbz/pod-infrastructure:latest"

systemctl restart kubelet.service

3.删除之前不成功的并重建:
[root@master test]# kubectl delete pod nginx
[root@master test]# kubectl create -f k8s_pod.yml
pod "nginx" created
[root@master test]# kubectl describe pods 
	Scheduled	Successfully assigned nginx to 10.0.0.12
[root@master test]#  kubectl get pods
NAME      READY     STATUS    RESTARTS   AGE
nginx     1/1       Running   0          3m



Logo

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

更多推荐