ImagePullBackOff错误Google Kubernetes引擎 [英] ImagePullBackOff error Google Kubernetes Engine
问题描述
我知道很多人已经有类似的问题,我读了其中的一些,但到目前为止,对我没有什么帮助.
I know a lot of people already had similar question, i read a few of them, but found nothing what actualy helped me so far.
我有一个启用了私有存储库的gitlab,我也使用Google Kubernetes Engine.我的私有仓库中有几个Docker容器,我想将其中一个部署到Kubernetes引擎.
I have a gitlab with private repo enabled, I also use Google Kubernetes Engine. I have a few Docker container in my private repo, and I want to deploy one of them to the Kubernetes Engine.
我用kubectl create secret generic db-user-pass --from-file=./username.txt --from-file=./password.txt
创建了一个秘密
我也试过kubectl create secret docker-registry name --docker-server=registry.xy.z --docker-username=google --docker-password=xyz --docker-email=xy@z.de
然后创建了我的部署文件:
I have created a secret with kubectl create secret generic db-user-pass --from-file=./username.txt --from-file=./password.txt
I also tried kubectl create secret docker-registry name --docker-server=registry.xy.z --docker-username=google --docker-password=xyz --docker-email=xy@z.de
Then I created my Deployment file:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: backend-test
labels:
app: 13371337
spec:
replicas: 1
template:
metadata:
labels:
app: 13371337
spec:
containers:
- name: backend
image: registry.xy.z/group/project/backend:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
imagePullSecrets:
- name: db-user-pass or name
任何想法如何使其运行?
Any ideas how to get it running?
推荐答案
使用kubectl create secret docker-registry name
是
Using kubectl create secret docker-registry name
is a right way to provide credentials of private docker registry.
imagePullSecrets
选项也看起来不错.
因此,从Kubernetes路径来看,一切看起来都很好.
So, from Kubernetes path everything looking good.
尝试检查将由Deployment创建的pod的事件,只需按kubectl get pods
找到您的pod并调用kubectl describe pod $name_of_your_pod
,您将看到它无法提取图像的实际原因.
Try to check events of the pod which will be created by Deployment, just find you pod by kubectl get pods
and call kubectl describe pod $name_of_your_pod
, you will see an actual reason why it cannot pull an image.
此外,如果您的存储库不安全或具有自签名证书,请尝试遵循该指南允许docker daemon从那里提取映像,这通常是映像提取失败的原因.
Also, if your depository is insecure or has self-signed certificate, try to follow that guide to allow docker daemon pulling image from there, that is an often reason of image pull failures.
这篇关于ImagePullBackOff错误Google Kubernetes引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!