我已将映像部署在gitlab docker存储库中
当我尝试在Kubernetes上部署我的应用程序时,出现以下错误
cluster-default-pool-2e5b4771-5z37
Normal BackOff 29s (x2 over 30s) kubelet, gke-gara-cluster-default-pool-2e5b4771-5z37 Back-off pulling image "registry.gitlab.com/gara-project/back-end-micro-services/mconsoleuser:latest"
Warning Failed 29s (x2 over 30s) kubelet, gke-gara-cluster-default-pool-2e5b4771-5z37 Error: ImagePullBackOff
Normal Pulling 15s (x2 over 31s) kubelet, gke-gara-cluster-default-pool-2e5b4771-5z37 pulling image "registry.gitlab.com/gara-project/back-end-micro-services/mconsoleuser:latest"
Warning Failed 14s (x2 over 30s) kubelet, gke-gara-cluster-default-pool-2e5b4771-5z37 Failed to pull image "registry.gitlab.com/gara-project/back-end-micro-services/mconsoleuser:latest": rpc error: code = Unknown desc = Error response from daemon: Get https://registry.gitlab.com/v2/gara-project/back-end-micro-services/mconsoleuser/manifests/latest: unauthorized: HTTP Basic: Access denied
Warning Failed 14s (x2 over 30s) kubelet, gke-gara-cluster-default-pool-2e5b4771-5z37 Error: ErrImagePull
我使用以下命令使用登录名和密码创建了一个秘密:
kubectl create secret docker-registry registry-gitlab-secrets --docker-server=registry.gitlab.com --docker-username=kosted --docker-password="MY-REAL-PASSWORD" \
--docker-email=mymail@yahoo.fr
我在部署中添加了
imagePullSecrets:
- name : registry-gitlab-secrets
我的整个部署如下:
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ include "m-consoleuser.name" . }}-deployment"
labels:
app: {{ include "m-consoleuser.name" . }}
tier: backend
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "m-consoleuser.name" . }}
tier: backend
template:
metadata:
labels:
app: {{ include "m-consoleuser.name" . }}
tier: backend
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 9102
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
imagePullSecrets:
- name: registry-gitlab-secrets
仍然出现相同的错误。请问我该怎么办?
编辑:我在节点之一内ssh并在kubectl创建密钥期间以与Provident相同的凭据运行docker login Registry.gitlab.com。登录成功,可以拉我的图像了。我不知道为什么在头盔部署期间我无法拉出图像