由于国内有一些公有云的服务器,访问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