【发布时间】:2019-07-10 13:46:44
【问题描述】:
在 Google Kubernetes Engine 中,我为我们公司创建了一个完美运行的 POC 集群。但是现在,当我尝试创建我们的生产环境时,我似乎无法让 imagesPullSecrets 工作,它与 POC 中完全相同的凭据、相同的 helm 图表和完全相同的 regcred yaml 文件。
但我一直在学习经典:
Back-off pulling image "registry.company.co/frontend/company-web/upload": ImagePullBackOff
- 在节点上手动拉取与我在 imagesPullSecret 中提供的凭据相同
- 我尝试在图表级别和服务帐户上定义 imagesPullSecret
- 我已经验证了秘密格式,并在尝试手动拉取时直接将凭据复制到那里
- GKE 获取 recred 并将其显示在部署中
由kubectl create secret docker-registry regcred --docker-server="registry.company.co" --docker-username="gitlab" --docker-password="[PASSWORD]"生成的Regcred
正规的秘密
kind: Secret
apiVersion: v1
metadata:
name: regcred
namespace: default
data:
.dockerconfigjson: eyJhdXRocyI6eyJyZWdpc3RyeS5jb21wYW55LmNvIjp7InVzZXJuYW1lIjoiZ2l0bGFiIiwicGFzc3dvcmQiOiJbUkVEQUNURURdIiwiYXV0aCI6IloybDBiR0ZpT2x0QmJITnZJRkpsWkdGamRHVmtYUT09In19fQ==
type: kubernetes.io/dockerconfigjson
服务帐号
kind: ServiceAccount
apiVersion: v1
metadata:
name: default
namespace: default
secrets:
- name: default-token-jktj5
imagePullSecrets:
- name: regcred
部署.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nfs-server
spec:
replicas: 1
selector:
matchLabels:
role: nfs-server
template:
metadata:
labels:
role: nfs-server
spec:
containers:
- name: nfs-server
image: gcr.io/google_containers/volume-nfs:latest
ports:
- name: nfs
containerPort: 2049
- name: mountd
containerPort: 20048
- name: rpcbind
containerPort: 111
securityContext:
privileged: true
volumeMounts:
- mountPath: /exports
name: mypvc
initContainers:
- name: init-volume-perms
imagePullPolicy: Always
image: alpine
command: ["/bin/sh", "-c"]
args: ["mkdir /mnt/company-logos; mkdir /mnt/uploads; chown -R 1337:1337 /mnt"]
volumeMounts:
- mountPath: /mnt
name: mypvc
- name: company-web-uploads
image: registry.company.co/frontend/company-web/uploads
imagePullPolicy: Always
volumeMounts:
- mountPath: /var/lib/company/web/uploads
subPath: uploads
name: mypvc
- name: company-logos
image: registry.company.co/backend/pdf-service/company-logos
imagePullPolicy: Always
volumeMounts:
- mountPath: /var/lib/company/shared/company-logos
subPath: company-logos
name: mypvc
volumes:
- name: mypvc
gcePersistentDisk:
pdName: gke-nfs-disk
fsType: ext4
我环顾四周,从头开始遵循不同的指南,但没有成功。
所以我完全不知道该怎么做。
默认命名空间
【问题讨论】:
-
我试图调查这个用例
echo "eyJhdXRocyI6eyJyZWdpc3RyeS5jb21wYW55LmNvIjp7InVzZXJuYW1lIjoiZ2l0bGFiIiwicGFzc3dvcmQiOiJbUkVEQUNURURdIiwiYXV0aCI6IloybDBiR0ZpT2x0QmJITnZJRkpsWkdGamRHVmtYUT09In19fQ==" | base64 -D {"auths":{"registry.company.co":{"username":"gitlab","password":"[REDACTED]","auth":"Z2l0bGFiOltBbHNvIFJlZGFjdGVkXQ=="}}}%这样看来,秘密是由某些代理提供的,可能 gitlab 将某些代理推送到集群。检查 prod 是否与 gitlab 集成?跨度> -
两种环境都没有与 gitlab 集成
标签: kubernetes google-kubernetes-engine kubernetes-helm docker-registry