kubernetes学习笔记:故障处理:通过yaml创建pod,状态一直是ContainerCreating

[root@test03 /]# kubectl get pods
NAME      READY     STATUS              RESTARTS   AGE
nginx01   0/1       ContainerCreating   0          7d
nginx03   0/1       ContainerCreating   0          40m

通过yaml创建了pod,检查的时候一直是ContainerCreating状态。

查看pod状态使用kubectl describe pod nginx03,

 发现docker从

 registry.access.redhat.com/rhel7/pod-infrastructure:latest  拉去镜像,

并提示details: (open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory)"

查看此文件,是做了一个软链接,但是/etc下面却没有rhsm目录。

[root@test03 /]# ll /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt
lrwxrwxrwx. 1 root root 27 Mar 6 22:57 /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt -> /etc/rhsm/ca/redhat-uep.pem

Events:
  FirstSeen     LastSeen        Count   From                    SubObjectPath   Type            Reason          Message
  ---------     --------        -----   ----                    -------------   --------        ------          -------
  38m           38m             1       {default-scheduler }                    Normal          Scheduled       Successfully assigned nginx03 to node02
  38m           1m              12      {kubelet node02}                        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)"

  38m   7s      166     {kubelet node02}                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\""

  

 

尝试安装yum install *rhsm*,安装完成后查看pod状态

[root@test03 /]# kubectl describe pod nginx01
Name:           nginx01
Namespace:      default
Node:           node01/192.168.50.129
Start Time:     Tue, 06 Mar 2018 23:54:33 +0800
Labels:         <none>
Status:         Pending
IP:
Controllers:    <none>
Containers:
  nginx01:
    Container ID:
    Image:                      nginx:latest
    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
  ---------     --------        -----   ----                    -------------   --------        ------          -------
  23h           58m             110     {kubelet node01}                        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)"

  23h   57m     2158    {kubelet node01}                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\""

  56m   9m      14      {kubelet node01}                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)"

  56m   4m      227     {kubelet node01}                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\""

  2m    2m      1       {kubelet node01}                                        Warning MissingClusterDNS       kubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. Falling back to DNSDefault policy.
  2m    2m      1       {kubelet node01}        spec.containers{nginx01}        Normal  Pulling                 pulling image "nginx:latest"

 发现状态为pulling状态,等一会儿describe查看,状态变为run

注意:rhsm安装需要再pod所在的node上安装

遗留问题:

1、默认的仓库应该是grc.io,这个却不是,后续查看镜像仓库设置。
    默认镜像仓库配置在每个node的配置问价 /etc/kubernetes/kubelet

KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"

可以配置成grc.io或则自建的docker仓库

2、rhsm的用途?

posted @ 2018-03-14 15:20  stromliu  阅读(8599)  评论(1编辑  收藏  举报