k8s集群集成镜像仓库

拿内置仓库举做demo,如果是harbor, 方式类似
1.首先下载并且加载register 仓库
docker pull registry
2.创建对应目录
mkdir -p home/storage/registry
mkdir -p /usr/local/src/docker/auth
3.用户名 密码
htpasswd -Bbn root root > /usr/local/src/docker/auth/htpasswd
4.启动镜像仓库
docker run -d -p 5000:5000 --restart=always --name registry1 -v /home/storage/registry:/var/lib/registry -v /usr/local/src/docker/auth:/auth -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd registry
5.创建secret
kubectl create secret docker-registry docker-myhub4 -n okdtest --docker-server=localhost ip --docker-username=root --docker-password=root
然后在自己的yaml文件里面


image.png

你可能感兴趣的:(k8s集群集成镜像仓库)