1. 程式人生 > >k8s環境問題及解決方案

k8s環境問題及解決方案

開發十年,就只剩下這套架構體系了! >>>   

一.k8s基本命令

kubectl get rc
kubectl delete rc mysql
kubectl get pod
kubectl delete pod mysql-xz2w
kubectl describe pod mysql-bx1rd

二.問題

1.k8s出現pod服務一直處於ContainerCreating狀態

執行kubectl describe pod [pod_name]

1.1問題:Back-off pulling image \"registry.access.redhat.com/rhel7/pod-infrastructure:latest

映象拉取失敗 手動執行docker命令拉取該映象

docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest 

提示如下:

Trying to pull repository registry.access.redhat.com/rhel7/pod-infrastructure ... 
open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory

解決方案:

 yum install *rhsm* -y  

#再次嘗試
docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest

如果還有問題執行一下操作

yum install -y wget   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

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

再次拉取映象應該就可以