yang@k8s-master:~$ kubectl get pod
NAME READY STATUS RESTARTS AGE
hello-world1-789db8d56-8xk5b 0/1 ImagePullBackOff 0 38s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 24s default-scheduler Successfully assigned default/hello-world1-789db8d56-8xk5b to k8s-node1
Normal Pulling 22s kubelet Pulling image "gcr.io/google-samples/hello-app:1.0"
Warning Failed 1s kubelet Failed to pull image "gcr.io/google-samples/hello-app:1.0": failed to pull and unpack image "gcr.io/google-samples/hello-app:1.0": failed to resolve reference "gcr.io/google-samples/hello-app:1.0": failed to do request: Head "https://gcr.io/v2/google-samples/hello-app/manifests/1.0": dial tcp 64.233.187.82:443: connect: connection refused
Warning Failed 1s kubelet Error: ErrImagePull
Normal BackOff 1s kubelet Back-off pulling image "gcr.io/google-samples/hello-app:1.0"
Warning Failed 1s kubelet Error: ImagePullBackOff
gcr.io/google-samples 镜像不能正常拉取
发现gcr.io禁止中国大陆地区访问
修改image地址 使用代理
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world1
spec:
replicas: 1
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-world
# image: gcr.io/google-samples/hello-app:1.0
image: gcr.lank8s.cn/google-samples/hello-app:1.0
ports:
- containerPort: 8080
yang@k8s-master:~$ kubectl delete deployments.apps hello-world1
deployment.apps "hello-world1" deleted
yang@k8s-master:~$ kubectl apply -f hello.yaml
deployment.apps/hello-world1 created
yang@k8s-master:~$ kubectl get pod
NAME READY STATUS RESTARTS AGE
hello-world1-64846684bd-l2m7s 1/1 Running 0 7s
k8s.gcr.io → lank8s.cn,gcr.io → gcr.lank8s.cn