问题是什么
对于nexus和harbor搭建的docker私有仓库,一般设置了密码,kubernetes的yaml上直接拉取镜像会报错
如:Get https://192.168.100.208:80/v2/: dial tcp 192.168.100.208:80: connect: connection refused
为什么出现
略
怎么解决
1、配置docker daemon.jsom
# sudo vi /etc/docker/daemon.json
{
“insecure-registries”: [“http://192.168.100.36:5000”, “http://192.168.100.208:80”],
“registry-mirrors”: [“https://t5t8q6wn.mirror.aliyuncs.com”],
“dns” : [ “114.114.114.114”,“8.8.8.8” ]
}
sudo systemctl restart docker
2、创建secret
kubectl create secret docker-registry registry-nexus --docker-server=192.168.31.109:5000 --docker-username=admin --docker-password=admin123
其中:
–registry-nexus: secret名称
–docker-server: 指定docker仓库地址
–docker-username: 指定docker仓库账号
–docker-password: 指定docker仓库密码
3、k8s yaml配置
containers:
- name: discovery-server-dev
\ image: 192.168.100.208:80/test/discovery-server-dev:1.0.0
imagePullSecrets:
- name: registry-nexus