momo's Blog.

k8s创建多仓库的secret

字数统计: 71阅读时长: 1 min
2022/11/07 Share

实现

需要把docker的config.json拿过来

1
2
3
4
5
6
7
8
9
10
{
"auths": {
"ccccc.com": {
"auth": "xxxxx=="
},
"aaaa.com": {
"auth": "xxxxxxxx"
}
}
}

通过命令行

1
2
3
kubectl create secret generic regcred \
--from-file=.dockerconfigjson=<path/to/.docker/config.json> \
--type=kubernetes.io/dockerconfigjson

通过yaml

1
2
3
4
5
6
7
8
apiVersion: v1
data:
.dockerconfigjson: {base64}
kind: Secret
metadata:
name: regcred
namespace: cd-test
type: kubernetes.io/dockerconfigjson
CATALOG
  1. 1. 实现
    1. 1.1. 通过命令行
    2. 1.2. 通过yaml