Kubernetes(K8S) 拉取镜像 ImagePullBackOff pull access denied

 K8S 拉取阿里云镜像  第一次用时,没注意 授权,所以在 kubectl apply 后一直出现  ImagePullBackOff

[root@k8smaster ~]# kubectl apply -f javademo1.yaml 
deployment.apps/javademo1 created
[root@k8smaster ~]# kubectl get pods
NAME                         READY   STATUS             RESTARTS   AGE
javademo1-55d6f5df9b-z2nqt   0/1     ImagePullBackOff   0          25s
nginx-f89759699-5hkdw        1/1     Running            0          5d1h 
[root@k8smaster ~]# kubectl describe pod javademo1-55d6f5df9b-z2nqt  
Name:         javademo1-55d6f5df9b-z2nqt
Namespace:    default
Priority:     0
Node:         k8snode1/172.16.3.182
Start Time:   Tue, 18 Oct 2022 19:13:56 +0800
Labels:       app=javademo1
              pod-template-hash=55d6f5df9b
Annotations:  <none>
Status:       Pending
IP:           10.244.1.3
IPs:
  IP:           10.244.1.3
Controlled By:  ReplicaSet/javademo1-55d6f5df9b
Containers:
  vipsoft:
    Container ID:   
    Image:          registry.cn-shanghai.aliyuncs.com/vipsoft/vipsoft:1.0
    Image ID:       
    Port:           <none>
    Host Port:      <none>
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-q7lps (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  default-token-q7lps:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-q7lps
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason     Age                   From               Message
  ----     ------     ----                  ----               -------
  Normal   Scheduled  15m                   default-scheduler  Successfully assigned default/javademo1-55d6f5df9b-cq4mt to k8snode1
  Normal   Pulling    13m (x4 over 15m)     kubelet            Pulling image "registry.cn-shanghai.aliyuncs.com/vipsoft/vipsoft:1.0"
  Warning  Failed     13m (x4 over 15m)     kubelet            Failed to pull image "registry.cn-shanghai.aliyuncs.com/vipsoft/vipsoft:1.0": rpc error: code = Unknown desc = Error response from daemon: pull access denied for registry.cn-shanghai.aliyuncs.com/vipsoft/vipsoft, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
  Warning  Failed     13m (x4 over 15m)     kubelet            Error: ErrImagePull
  Warning  Failed     10m (x21 over 15m)    kubelet            Error: ImagePullBackOff
  Normal   BackOff    5m11s (x43 over 15m)  kubelet            Back-off pulling image "registry.cn-shanghai.aliyuncs.com/vipsoft/vipsoft:1.0"

解决方案,详见:K8S 拉取阿里云镜像 1、2 两步

最后执行 

[root@k8smaster ~]# kubectl replace -f javademo1.yaml

 

posted @ 2022-10-19 11:19  VipSoft  阅读(808)  评论(0编辑  收藏  举报