环境说明

未安全认证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