使用k8s創建容器一直處於ContainerCreating狀態


容器報錯信息為(兩種):

FailedSynError 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)" 13m 11s 56 {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\""

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)"

大致意思就是:未能通過ErrImagePull為“POD”啟動“StartContainer”:“對於registry.access.redhat.com/rhel7/pod-infrastructure:latest,圖像拉出失敗,這可能是因為此請求上沒有證書

檢查發現:/etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt這個目錄中是一個軟連接

發現實際上並沒有這個文件:

其實在我的k8s編排工具使用文檔中我提過這個錯誤,說是因為證書導致的, 然后下載一個  yum remove *rhsm* -y  就可以解決,但是我最近溫習一遍后發現這個rhsm文件被調換了,下載后發現是空的,然后找方法解決。

 

解決方法:下載rpm包安裝

wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm
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

  注釋:rpm2cpio命令用於將rpm軟件包轉換為cpio格式的文件

       cpio命令主要是用來建立或者還原備份檔的工具程序,cpio命令可以復制文件到歸檔包中,或者從歸檔包中復制文件。          

           -i   還原備份檔  

           -v  詳細顯示指令的執行過程

最后解決了!

 


免責聲明!

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



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