How to add private Docker registry to Rancher
Via kubectl
kubectl -n kube-system create secret docker-registry gitlab \
--docker-server="registry.example.com" \
[email protected] \
--docker-username=name \
--docker-password=password
Via Kubernetes yaml
apiVersion: v1
data:
.dockerconfigjson: eyJhdXRocyI6eyJyZWdpc3RyeS5leGFtcGxlLmNvbSI6eyJ1c2VybmFtZSI6Im5hbWUiLCJwYXNzd29yZCI6InBhc3N3b3JkIiwiZW1haWwiOiJyZWdpc3RyeUBleGFtcGxlLmNvbSIsImF1dGgiOiJibUZ0WlRwd1lYTnpkMjl5WkE9PSJ9fX0=
kind: Secret
metadata:
name: gitlab
namespace: kube-system
type: kubernetes.io/dockerconfigjson
where .dockerconfigjson is base64
{"auths":{"registry.example.com":{"username":"name","password":"password","email":"[email protected]","auth":"bmFtZTpwYXNzd29yZA=="}}}
where auth is base64
name:password