Docker学习之路

kubernetes启动容器时,容器一直是ContainerCr

2018-11-19  本文已影响0人  李凈海

  Kubernetes创建启动容器:

  --------------------------------------------------------------------

  [docker@localhost ~]$ kubectl create -f kubernetes_yaml/

  replicationcontroller "mysql" created

  service "mysql" created

  replicationcontroller "myweb" created

  service "myweb" created

  --------------------------------------------------------------------

  检查pod:

  --------------------------------------------------------------------

  [docker@localhost ~]$ kubectl get pods

  NAME          READY    STATUS              RESTARTS  AGE

  mysql-7shv6  0/1      ContainerCreating  0          6s

  myweb-2vg5v  0/1      ContainerCreating  0          6s

  myweb-hz3zd  0/1      ContainerCreating  0          6s

  --------------------------------------------------------------------

  这是容器状态都属于ContainerCreating,而不是Running



  解决方案:

  方案一:

  --------------------------------------------------------------------

  [root@localhost ~]# yum install *rhsm* -y

  [root@localhost ~]# docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest

  --------------------------------------------------------------------

  到这里如果检查pod状态还是ContainerCreating,尝试方案二



  方案二:

  --------------------------------------------------------------------

  [root@localhost ~]# docker pull docker.io/kubernetes/pause

  [root@localhost ~]# docker tag docker.io/kubernetes/pause gcr.io/google_containers/pause-amd64:3.0

  [root@k8s ~]# docker rmi -f docker.io/kubernetes/pause

  --------------------------------------------------------------------

  到这里先进行delete,在重新创建容器

  --------------------------------------------------------------------

  [docker@localhost ~]$ kubectl delete -f kubernetes_yaml/

  replicationcontroller "mysql" deleted

  service "mysql" deleted

  replicationcontroller "myweb" deleted

  service "myweb" deleted

  --------------------------------------------------------------------

  新建完成后,进行检查pod状态,如果还是ContainerCreating状态,方案三一定可以解决



  方案三:

  --------------------------------------------------------------------

  [root@localhost ~]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm

  [root@localhost ~]# rpm2cpio python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm | cpio -iv --to-stdout ./etc/rhsm/ca/redhat-uep.pem | tee /etc/rhsm/ca/redhat-uep.pem

  [root@localhost ~]# docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest

  --------------------------------------------------------------------

  到这里就算结束了,这三种方案一定会解决【open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory】证书的问题。

上一篇下一篇

猜你喜欢

热点阅读