kubernetes如果遇到ImagePullBackOff該如何排查呢?
狀態(tài)
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
sentry-web 0/1 ImagePullBackOff 0 4m55s
ImagePullBackOff
代表拉取鏡像時(shí)被阻塞,最常見的原因是鏡像不存在。
原因
使用 kubectl describe pod sentry-web
查看啟動(dòng)細(xì)節(jié):
$ kubectl describe pod sentry-web
Name: sentry-web
Namespace: default
...省略
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 4m50s default-scheduler Successfully assigned default/sentry-web to kind-control-plane
Normal Pulling 3m14s (x4 over 4m51s) kubelet Pulling image "sentry-self-hosted-local"
Warning Failed 3m10s (x4 over 4m44s) kubelet Failed to pull image "sentry-self-hosted-local": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/sentry-self-hosted-local:latest": failed to resolve reference "docker.io/library/sentry-self-hosted-local:latest": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
Warning Failed 3m10s (x4 over 4m44s) kubelet Error: ErrImagePull
Warning Failed 2m44s (x6 over 4m43s) kubelet Error: ImagePullBackOff
Normal BackOff 2m29s (x7 over 4m43s) kubelet Back-off pulling image "sentry-self-hosted-local"
發(fā)現(xiàn)原因是
failed to pull and unpack image "docker.io/library/sentry-self-hosted-local:latest"
結(jié)合細(xì)節(jié)
看我的配置文件:
kind: Pod
apiVersion: v1
metadata:
name: sentry-web
labels:
app: sentry
spec:
hostNetwork: true
containers:
- name: sentry-web
image: sentry-self-hosted-local
這個(gè)鏡像只有我本地有,但是他還是去拉遠(yuǎn)程,原因是我沒寫tag.文章來源:http://www.zghlxwxcb.cn/news/detail-519992.html
為了讓錯(cuò)誤更明顯,改為只使用本地:文章來源地址http://www.zghlxwxcb.cn/news/detail-519992.html
spec:
hostNetwork: true
containers:
- name: sentry-web
image: sentry-self-hosted-local:latest
imagePullPolicy: Never # or IfNotPresent
到了這里,關(guān)于k8s ImagePullBackOff的原因的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!