1. 程式人生 > >Kubernetes建立pod一直處於ContainerCreating排查和解決

Kubernetes建立pod一直處於ContainerCreating排查和解決

用k8s建立完pod後,發現無法訪問demo應用,查了一下pods狀態,發現都在containercreationg狀態中。

clip_image001

百度了一下,根據網上的方法,查了一下mysql-jn6f2這個pods的詳情

clip_image003

其中最主要的問題是:details: (open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory)

解決方案:

檢視/etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt (該連結就是上圖中的說明) 是一個軟連結,但是連結過去後並沒有真實的/etc/rhsm,所以需要使用yum安裝:

yum install *rhsm*

安裝完成後,執行一下docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest

如果依然報錯,可參考下面的方案:

這兩個命令會生成/etc/rhsm/ca/redhat-uep.pem檔案.

順得的話會得到下面的結果。

[[email protected]]# docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest

Trying to pull repository registry.access.redhat.com/rhel7/pod-infrastructure ...

latest: Pulling from registry.access.redhat.com/rhel7/pod-infrastructure

26e5ed6899db: Pull complete

66dbe984a319: Pull complete

9138e7863e08: Pull complete

Digest: sha256:92d43c37297da3ab187fc2b9e9ebfb243c1110d446c783ae1b989088495db931

Status: Downloaded newer image for registry.access.redhat.com/rhel7/pod-infrastructure:latest

刪除原來建立的rc

[[email protected] /]# kubectl delete -f mysql-rc.yaml

重新建立

[[email protected] /]# kubectl create -f mysql-rc.yaml

replicationcontroller "mysql" created

再次檢視狀態

[[email protected] /]# kubectl get pod

NAME READY STATUS RESTARTS AGE

mysql-b8m2q 1/1 Running 0 27m

一切正常。