1. 程式人生 > >kubernetes下載docker私有倉庫鏡像

kubernetes下載docker私有倉庫鏡像

docker-registry imagePullSecrets kubernetes

環境說明

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

kubernetes下載docker私有倉庫鏡像