$ kubectl create secret docker-registry <name> --docker-server <registry-server> --docker-username <username> --docker-password <password> [--docker-email <email>]
$ kubectl create secret docker-registry tencent --docker-server ccr.ccs.tencentyun.com --docker-username 100002518402 --docker-password Love1314
$ kubectl get secret tencent -o yaml
apiVersion: v1
kind: Secret
metadata:
name: tencent
namespace: default
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: eyJhdXRocyI6eyJjY3IuY2NzLnRlbmNlbnR5dW4uY29tIjp7InVzZXJuYW1lIjoiMTAwMDAyNTE4NDAyIiwicGFzc3dvcmQiOiJMb3ZlMTMxNCIsImF1dGgiOiJNVEF3TURBeU5URTROREF5T2t4dmRtVXhNekUwIn19fQ==
$ echo -n "eyJhdXRocyI6eyJjY3IuY2NzLnRlbmNlbnR5dW4uY29tIjp7InVzZXJuYW1lIjoiMTAwMDAyNTE4NDAyIiwicGFzc3dvcmQiOiJMb3ZlMTMxNCIsImF1dGgiOiJNVEF3TURBeU5URTROREF5T2t4dmRtVXhNekUwIn19fQ==" | base64 -d
{"auths":{"ccr.ccs.tencentyun.com":{"username":"100002518402","password":"Love1314","auth":"MTAwMDAyNTE4NDAyOkxvdmUxMzE0"}}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: tomcat
spec:
replicas: 1
selector:
matchLabels:
app: tomcat
template:
metadata:
labels:
app: tomcat
spec:
imagePullSecrets:
- name: tencent
containers:
- name: container1
image: ccr.ccs.tencentyun.com/pshizh/tomcat:8