我无法让Kubernetes提取我的私有docker映像
我在我的default
命名空间中有一个名为regcred
的kubernetes秘密,如下所示:
{"auths": {"index.docker.io": {"username": "Username", "password": "Password", "email": "random@email.com", "auth": "VXNlcm5hbWU6UGFzc3dvcmQ="}}}
验证值为Username:Password
b64编码。
这是我试图创建的pod,每次使用ImagePullBackOff
都失败。
apiVersion: v1
kind: Pod
metadata:
name: private-reg
spec:
containers:
- name: private-reg-container
image: index.docker.io/jor2/hello-world:latest
imagePullSecrets:
- name: regcred
日志:
Error from server (BadRequest): container "private-reg-container" in pod "private-reg" is waiting to start: image can't be pulled
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 67s default-scheduler Successfully assigned default/private-reg to 10.144.195.222
Normal Pulling 20s (x3 over 66s) kubelet Pulling image "index.docker.io/jor2/hello-world"
Warning Failed 17s (x3 over 63s) kubelet Failed to pull image "index.docker.io/jor2/hello-world": rpc error: code = NotFound desc = failed to pull and unpack image "docker.io/jor2/hello-world:latest": failed to unpack image on snapshotter overlayfs: unexpected media type text/html for sha256:361849f1befca621043d13cca4e9bee74861754154556e149340a455e53d1d35: not found
Warning Failed 17s (x3 over 63s) kubelet Error: ErrImagePull
Normal BackOff 3s (x3 over 63s) kubelet Back-off pulling image "index.docker.io/jor2/hello-world"
Warning Failed 3s (x3 over 63s) kubelet Error: ImagePullBackOff
秘密是这样的:
apiVersion: v1
data:
.dockerconfigjson: eyJhdXRocyI6IHsiaHR0cHM6Ly9pbmRleC5kb2NrZXIuaW8vdjEvIjogeyJ1c2VybmFtZSI6ICJVc2VybmFtZSIsICJwYXNzd29yZCI6ICJQYXNzd29yZCIsICJlbWFpbCI6ICJyYW5kb21AZW1haWwuY29tIiwgImF1dGgiOiAiVlhObGNtNWhiV1U2VUdGemMzZHZjbVE9In19fQo=
kind: Secret
metadata:
creationTimestamp: "2022-04-25T18:59:03Z"
managedFields:
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:data:
.: {}
f:.dockerconfigjson: {}
f:type: {}
manager: kubectl-create
operation: Update
time: "2022-04-25T18:59:03Z"
name: regcred
namespace: default
resourceVersion: "270226"
uid: bbb1310b-421a-4c93-8488-498e7a52095f
type: kubernetes.io/dockerconfigjson
你知道我哪里错了吗?
这是我的图像和pod规格需要的问题:
apiVersion: v1
kind: Pod
metadata:
name: private-reg
spec:
containers:
- name: private-reg-container
image: jor2/hello-world:latest
imagePullSecrets:
- name: regcred