gpt4 book ai didi

kubernetes - 版本 "v1"中的 Secret 不能作为 Secret : v1. Secret.Data : ReadMapCB: expect { or n, but found ",在 #10 字节中发现错误

转载 作者:行者123 更新时间:2023-12-02 12:37:09 31 4
gpt4 key购买 nike

我正在尝试为 kubernetes 集群设置私有(private) docker 镜像注册表。我正在关注 link

 $ cat ~/.docker/config.json | base64
ewoJImF1dGhzIjogewoJCSJsb2NhbGhvc3Q6NTAwMDAiOiB7CgkJCSJhdXRoIjogImJYbDFjMlZ5
T21oMGNHRnpjM2RrIgoJCX0KCX0KfQ==

我有文件 image-registry-secrets.yaml内容如下——
apiVersion: v1
kind: Secret
metadata:
name: registrypullsecret
data:
.dockerconfigjson:ewoJImF1dGhzIjogewoJCSJsb2NhbGhvc3Q6NTAwMDAiOiB7CgkJCSJhdXRoIjogImJYbDFjMlZ5T21oMGNHRnpjM2RrIgoJCX0KCX0KfQ==
type: kubernetes.io/dockerconfigjson

当我运行以下命令时
$kubectl create -f image-registry-secrets.yaml --validate=false && kubectl get secrets
Error from server (BadRequest): error when creating "image-registry-secrets.yml": Secret in version "v1" cannot be handled as a Secret: v1.Secret.Data: ReadMapCB: expect { or n, but found ", error found in #10 byte of ...|","data":".dockercon|..., bigger context ...|{"apiVersion":"v1","data":".dockerconfigjson:ewoJImF1dGhzIjogewoJCSJsb2NhbGhv|...
kubectl create -f image-registry-secrets.yaml --validate=false 中的问题是什么?以及如何解决此错误。

Kubernetes 版本是 -
$kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.0", GitCommit:"ddf47ac13c1a9483ea035a79cd7c10005ff21a6d", GitTreeState:"clean", BuildDate:"2018-12-03T21:04:45Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.4", GitCommit:"c27b913fddd1a6c480c229191a087698aa92f0b1", GitTreeState:"clean", BuildDate:"2019-02-28T13:30:26Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}

最佳答案

您需要在 .dockerconfigjson 之后包含一个空格,并且在base64字符串之前 - 之后它应该可以工作。

关于kubernetes - 版本 "v1"中的 Secret 不能作为 Secret : v1. Secret.Data : ReadMapCB: expect { or n, but found ",在 #10 字节中发现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54965104/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com