解码核对
解码核对
kubectl get secret regcred -n prod -o jsonpath='{.data.\.dockerconfigjson}' | base64 -d | head -c 300
# 形如 {"auths":{"registry.example.com":{"auth":"<base64(user:pass)>"}}}从现有文件创建
从现有文件创建
kubectl create secret generic regcred \
--from-file=.dockerconfigjson=$HOME/.docker/config.json \
--type=kubernetes.io/dockerconfigjson -n prodauth 字段是 user:password 的 base64;含多个仓库的 config.json 可以整体导入。