CentOS 7.5单机安装Kubernetes(4)

发现pod状态无论多久都是处于pending。READY字段一直是0/1,服务部署失败的原因是”中国墙“的问题导致无法下载pod启动时需要的谷歌镜像,所以我们得间接的创建所需的镜像。

补充: Pending状态表示API Server已经创建Pod,但Pod内还有一个或者多个容器没有创建,或者正在下载镜像的过程。详细的参考Pod声明周期和重启策略

查看pod信息

[root@localhost software]# kubectl describe pod myk8s-pod-1394982580-11h8h
Name:          myk8s-pod-1394982580-11h8h
Namespace:      default
Node:          127.0.0.1/127.0.0.1
Start Time:    Fri, 29 Mar 2019 11:21:03 +0800
Labels:        pod-template-hash=1394982580
                run=myk8s-pod
Status:        Pending
IP:
Controllers:    ReplicaSet/myk8s-pod-1394982580
Containers:
  myk8s-pod:
    Container ID:
    Image:                      base_tomcat
    Image ID:
    Port:                      80/TCP
    State:                      Waiting
      Reason:                  ContainerCreating
    Ready:                      False
    Restart Count:              0
    Volume Mounts:              <none>
    Environment Variables:      <none>
Conditions:
  Type          Status
  Initialized  True
  Ready        False
  PodScheduled  True
No volumes.
QoS Class:      BestEffort
Tolerations:    <none>
Events:
  FirstSeen    LastSeen        Count  From                    SubObjectPath  Type            Reason          Message
  ---------    --------        -----  ----                    -------------  --------        ------          -------
  15m          15m            1      {default-scheduler }                    Normal          Scheduled      Successfully assigned myk8s-pod-1394982580-11h8h to 127.0.0.1
  15m          4m              7      {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)"

14m  11s    63      {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\""

[root@localhost software]#


##百度 pod ContainerCreating

[root@localhost shell]# docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest
Trying to pull repository registry.access.redhat.com/rhel7/pod-infrastructure ...
sha256:92d43c37297da3ab187fc2b9e9ebfb243c1110d446c783ae1b989088495db931: Pulling from registry.access.redhat.com/rhel7/pod-infrastructure
26e5ed6899db: Pull complete
66dbe984a319: Pull complete
9138e7863e08: Pull complete
Digest: sha256:92d43c37297da3ab187fc2b9e9ebfb243c1110d446c783ae1b989088495db931
Status: Image is up to date for registry.access.redhat.com/rhel7/pod-infrastructure:latest

##制作新镜像,因kubectl describe pod myk8s-pod-2-2707079129-1305m 提示找不到 docker.io/base-tomcat,那么我们就制作一个

[root@localhost registry.access.redhat.com]# docker tag base_tomcat:tomcat-centos docker.io/base-tomcat:v1

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/1fc3446ea974cdb3376483cc5ffa8e1d.html