一、配置
1、docker
vim /etc/docker/daemon.json
{"insecure-registries": ["192.168.10.122"]}
systemctl daemon-reload
systemctl restart docker
二、方式一
1、登录
docker login 192.168.10.122 -u admin -p Harbor12345
2、查看config.json文件
cat ~/.docker/config.json
{
"auths": {
"192.168.10.122": {
"auth": "YWRtaW46SGFyYm9yMTIzNDU="
}
}
}
echo 'YWRtaW46SGFyYm9yMTIzNDU=' |base64 -d
admin:Harbor12345
3、基于现有Docker凭据创建secret
kubectl create secret generic admin-harbor \
--from-file=.dockerconfigjson=/root/.docker/config.json \
--type=kubernetes.io/dockerconfigjson
4、查看内容
kubectl get secrets admin-harbor --output="jsonpath={.data.\.dockerconfigjson}" | base64 -d
三、方式二
kubectl create secret docker-registry admin-harbor \
--docker-server=192.168.6.20:80 \
--docker-username=admin \
--docker-password='Harbor12345' \
[email protected] \
--namespace kube-system
四、在具体的Pod中引用
imagePullSecrets:
- name: harborsecret
标签:harbor,FAQ,192.168,拉取,admin,json,--,docker
From: https://www.cnblogs.com/jluo/p/17948059