由于docker pull image失败,导致k8s pod卡在ContainerCreating状态

国内公有云服务器访问docker.io不稳定,使得Kubernetes (k8s) Pod在尝试ContainerCreating时因无法成功拉取nginx镜像而卡住。检查pod events显示image拉取失败。即使使用国内镜像,问题依然存在,可能需要检查kubelet状态和日志。解决方案引用电影《摩天营救》台词,简单但有效:“重启试试”。
摘要由CSDN通过智能技术生成

由于国内有一些公有云的服务器,访问docker.io非常不稳定, 导致pull image一直是失败的,

nginx.yaml

# cat nginx.yaml 
apiVersion: v1
kind: ReplicationController
metadata:
  name: myweb
spec:
  replicas: 2        
  selector:
    app: myweb
  template:
    metadata:
      labels:
        app: myweb
    spec:
      containers:
        - name: myweb
          #image: registry.cn-shenzhen.aliyuncs.com/yansongda/nginx:latest  #访问稳定
          image: nginx  # 访问不稳定的image
          ports:
          - containerPort: 80

 

 

查看pod的events, 最后一行, 一直提示 pulling image "nginx"

# kubectl describe pod myweb-fq
Name:           myweb-fqhxm
Namespace:      default
Node:           test.novalocal/172.16.0.138
Start Time:     Thu, 09 Aug 2018 17:10:58 +0800
Labels:         app=myweb
Annotations:    <none>
Status:         Pending
IP:             
Controlled By:  ReplicationController/myweb
Containers:
  myweb:
    Container ID:   
    Image:          nginx
    Image ID:       
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-s7722 (ro)
Conditions:
  Type           Status
  Initialized    True 
  Ready          False 
  PodScheduled   True 
Volumes:
  default-token-s7722:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-s7722
    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                     Mess
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值