K8S (kubernetes)pod服务 Status 处于 Containercreating,Ready处于0/1 的问题解决

当K8S Pod状态显示为ContainerCreating且Ready为0/1时,通常意味着容器创建失败。错误信息涉及到Docker证书问题。解决步骤包括检查/etc/docker/certs.d/registry.access.redhat.com/目录下的证书链接,发现redhat-ca.crt为无效链接。通过卸载subscription-manager-rhsm-certificates并安装python-rhsm-certificates.x86_64,成功解决问题,Pod状态转为Running,Ready变为1/1。

运行命令

kubectl get pod

pod的status是ContainerCreating,Ready处于0/1

[root@localhost ca]# kubectl get pod
NAME                       READY     STATUS              RESTARTS   AGE
my-nginx-379829228-mmsww   0/1       ContainerCreating   0          1h

错误信息为

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

根据网上资料进行手工pull,提示报错误

/etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory

cd到/etc/docker/certs.d/registry.access.redhat.com/看到有一个redhat-ca.crt文件,使用 ll 命令查看

ll redhat-ca.crt

是个link文件,redhat-ca.crt -> /etc/rhsm/ca/redhat-uep.pem还一直闪啊闪,说明没有这个链接的文件。 

按照网上思路,进行更新安装,然后查询

yum update

yum search rhsm
==================================================================================== N/S matched: rhsm =====================================================================================
librhsm-devel.x86_64 : Development libraries and header files for librhsm
librhsm.x86_64 : Red Hat Subscription Manager library
python-rhsm.x86_64 : A Python library to communicate with a Red Hat Unified Entitlement Platform
python-rhsm-certificates.x86_64 : Certificates required to communicate with a Red Hat Unified Entitlement Platform
rhsm-gtk.x86_64 : GTK+ widgets used by subscription-manager-gui and initial_setup
subscription-manager-rhsm.x86_64 : A Python library to communicate with a Red Hat Unified Entitlement Platform
subscription-manager-rhsm-certificates.x86_64 : Certificates required to communicate with a Red Hat Unified Entitlement Platform

按网上思路使用命令安装 rhsm 的文件

yum install *rhsm*

然而,问题依然存在,仔细看信息发现

Package python-rhsm-certificates is obsoleted by subscription-manager-rhsm-certificates, trying to install subscription-manager-rhsm-certificates-1.21.10-3.el7.centos.x86_64 instead

说明python-rhsm-certificates 被 subscription-manager-rhsm-certificates 替代,所以python-rhsm-certificates一直无法安装

解决方案:

先将subscription-manager-rhsm-certificates卸载

yum remove subscription-manager-rhsm-certificates.x86_64

然后安装python-rhsm-certificates.x86_64

yum install python-rhsm-certificates.x86_64

最终安装成功,pod的状态变为Running,Ready为1/1

[root@localhost ca]# kubectl get pod
NAME                       READY     STATUS    RESTARTS   AGE
my-nginx-379829228-mmsww   1/1       Running   0          2h

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值