私有化镜像库的验证(转)

2019-03-12 11:14:59 浏览数 (1)

增加验证到指定的namespaces

代码语言:javascript复制
kubectl create secret docker-registry  regsecret --docker-server=registry-vpc.cn-hangzhou.aliyuncs.com --docker-username=admin --docker-password=123456 --docker-email=xxxx@qq.com -n namespaces

yaml的方式

代码语言:javascript复制
kind: Secret
apiVersion: v1
metadata:
  name: regsecret
type: kubernetes.io/dockercfg
data:
  ".dockercfg": eyJyZWdpc3RyeS12cGMuY24taGFuZ3pob3UuYWxpeXVuY3MuY29tIjp7InVzZXJuYW1lIjoiYWRtaW4iLCJwYXNzd29yZCI6IjEyMzQ1NiIsImVtYWlsIjoieHh4eEBxcS5jb20iLCJhdXRoIjoiWVdSdGFXNDZNVEl6TkRVMiJ9fQ==

base64的由来

代码语言:javascript复制
#cat > xx <<EOF
{"registry-vpc.cn-hangzhou.aliyuncs.com":{"username":"admin","password":"123456","email":"xxxx@qq.com","auth":"YWRtaW46MTIzNDU2"}}
EOF
#base64 xx

使用

代码语言:javascript复制
...
"template" => ['spec' => [
	"hostNetwork" => true,
	"imagePullSecrets" => [['name' => 'your-registry-secret-name']],
	"restartPolicy" => 'Never',
	"containers" => [[
...

0 人点赞