kubernetes 載入pod出現ErrImageNeverPull錯誤

冰雪封存的記憶發表於2022-11-01

1.使用kubectl get pod檢視pod狀態出現status為ErrImageNeverPull

NAME                                   READY   STATUS              RESTARTS   AGE
flaskapi-deployment-59bcb745ff-4x2d2   0/1     ErrImageNeverPull   0          3m58s
flaskapi-deployment-59bcb745ff-6mgqx   0/1     ErrImageNeverPull   0          3m58s
flaskapi-deployment-59bcb745ff-7xtgf   0/1     ErrImageNeverPull   0          3m58s
  1. 使用kubectl describe pod <pod_name>檢視相應pod的狀態情況
    Name:         flaskapi-deployment-59bcb745ff-4x2d2
    Namespace:    default
    Priority:     0
    Node:         kmaster1/192.168.0.165
    Start Time:   Mon, 31 Oct 2022 11:23:41 -0400
    Labels:       app=flaskapi
               pod-template-hash=59bcb745ff
    Annotations:  <none>
    Status:       Pending
    IP:           10.244.1.24
    IPs:
    IP:           10.244.1.24
    Controlled By:  ReplicaSet/flaskapi-deployment-59bcb745ff
    Containers:
    flaskapi:
     Container ID:   
     Image:          flask-api
     Image ID:       
     Port:           5000/TCP
     Host Port:      0/TCP
     State:          Waiting
       Reason:       ErrImageNeverPull
     Ready:          False
     Restart Count:  0
     Environment:
       db_root_password:  <set to the key 'db_root_password' in secret 'flaskapi-secrets'>  Optional: false
       db_name:           flaskapi
     Mounts:
       /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-nm6gp (ro)
    Conditions:
    Type              Status
    Initialized       True 
    Ready             False 
    ContainersReady   False 
    PodScheduled      True 
    Volumes:
    kube-api-access-nm6gp:
     Type:                    Projected (a volume that contains injected data from multiple sources)
     TokenExpirationSeconds:  3607
     ConfigMapName:           kube-root-ca.crt
     ConfigMapOptional:       <nil>
     DownwardAPI:             true
    QoS Class:                   BestEffort
    Node-Selectors:              <none>
    Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                              node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
    Events:
    Type     Reason             Age                     From               Message
    ----     ------             ----                    ----               -------
    Normal   Scheduled          5m                      default-scheduler  Successfully assigned default/flaskapi-deployment-59bcb745ff-4x2d2 to kmaster1
    Warning  Failed             2m57s (x12 over 4m53s)  kubelet            Error: ErrImageNeverPull
    Warning  ErrImageNeverPull  2m44s (x13 over 4m53s)  kubelet            Container image "flask-api" is not present with pull policy of Never
    由此可以看出原因是pull本地的image出現了問題
  2. 解決方案
    把deployment.yaml檔案中的imagePullPolicy: Never刪除掉就好了
    [References]: Error: ErrImageNeverPull
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章