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的用途?


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM