环境说明
docker仓库未认证地址:192.168.10.200:5000
用户名:admin
密码:admin
邮箱:[email protected]
修改docker配置,访问docker私有仓库
1.docker源生版本
$cat /etc/sysconfig/docker
# /etc/sysconfig/docker
# Modify these options if you want to change the way the docker daemon runs
OPTIONS=‘--selinux-enabled --log-driver=journald --signature-verification=false --insecure-registry=192.168.10.200:5000‘
2.docker-ce版本
$cat /etc/docker/daemon.json
{
"insecure-registries" : ["192.168.10.200:5000"]
}
重启docker服务
创建k8s secret,访问docker私有仓库
1.生成secret docker-registry
kubectl create secret docker-registry registrykey-01 --docker-server=192.168.10.200:5000 --docker-username=admin --docker-password=admin [email protected]
2.修改yaml文件,配置imagePullSecrets
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
template:
spec:
imagePullSecrets:
- name: registrykey-01
containers:
- name: nginx
image: nginx:latest
原文地址:http://blog.51cto.com/2759492/2086387
时间: 2024-11-10 08:36:36