1 问题详情

创建nginx

kubectl run nginx --image=nginx --replicas=2 --port=80

发现一直处于ContainerCreating

kubectl -s 'http://127.0.0.1:8099' get pods
NAME                    READY     STATUS              RESTARTS   AGE
nginx-203864630-6rfgg   0/1       ContainerCreating   0          11m
nginx-203864630-zvgpt   0/1       ContainerCreating   0          11m

查看容器状态

kubectl -s 'http://127.0.0.1:8099' describe pod nginx-203864630-6rfgg

Name:           nginx-203864630-6rfgg
Namespace:      default
Node:           127.0.0.1/127.0.0.1
Start Time:     Thu, 18 Jun 2020 16:30:44 +0800
Labels:         pod-template-hash=203864630
                run=nginx
Status:         Pending
IP:
Controllers:    ReplicaSet/nginx-203864630
Containers:
  nginx:
    Container ID:
    Image:                      nginx
    Image ID:
    Port:                       8097/TCP
    State:                      Waiting
      Reason:                   ContainerCreating
    Ready:                      False
    Restart Count:              0
    Volume Mounts:              <none>
    Environment Variables:      <none>
Conditions:
  Type          Status
  Initialized   True 
  Ready         False 
  PodScheduled  True 
No volumes.
QoS Class:      BestEffort
Tolerations:    <none>
Events:
  FirstSeen     LastSeen        Count   From                    SubObjectPath   Type            Reason          Message
  ---------     --------        -----   ----                    -------------   --------        ------          -------
  12m           12m             1       {default-scheduler }                    Normal          Scheduled       Successfully assigned nginx-203864630-6rfgg to 127.0.0.1
  12m           1m              7       {kubelet 127.0.0.1}                     Warning         FailedSync      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)"

  12m   11s     52      {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\""

2 解决过程

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


3 结果

kubectl -s 'http://127.0.0.1:8099' get pods
NAME                    READY     STATUS    RESTARTS   AGE
nginx-203864630-6rfgg   1/1       Running   0          16m
nginx-203864630-zvgpt   1/1       Running   0          16m

 

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐