k8s v1.9.9 二进制部署 (8)master上创建仓库
1.拉取仓库的镜像,并创建仓库
docker pull registry
docker run -d -p 5000:5000 --restart=always --name=registry -v /opt/myregistry:/var/lib/registry registry
2.上传本地镜像并导入。
ll /root/
docker load -i coredns.tar.gz
docker load -i dash.tar.gz
docker load -i heap.tar.gz
docker load -i puase.tar.gz
3.打tag
docker images
docker tag coredns/coredns:1.2.0 192.168.7.131:5000/coredns:v1.2
docker tag registry:5000/kubernetes-dashboard-amd64:v1.8.3 192.168.7.131:5000/dashboard:v1.8.3
docker tag registry:5000/google_containers/heapster-amd64:v1.5.1 192.168.7.131:5000/heapster:v1.5.1
docker tag registry:5000/pause-amd64:3.0 192.168.7.131:5000/pause:v3.0
4.删除原来导入的镜像
docker images
docker rmi coredns/coredns:1.2.0
docker rmi registry:5000/kubernetes-dashboard-amd64:v1.8.3
docker rmi registry:5000/google_containers/heapster-amd64:v1.5.1
docker rmi registry:5000/pause-amd64:3.0
5.所有节点配置镜像加速和仓库地址
$vim //etc/docker/daemon.json
$cat /etc/docker/daemon.json
{
"registry-mirrors": ["http://hub-mirror.c.163.com"], #网易镜像加速器
"insecure-registries":["192.168.7.131:5000"] #仓库的地址
}
[root@master131 ~]# scp /etc/docker/daemon.json root@192.168.7.132:/etc/docker/
[root@master131 ~]# scp /etc/docker/daemon.json root@192.168.7.133:/etc/docker/
$systemctl restart docker #所有节点重启docker服务
6.推送镜像到仓库和查看仓库现有的镜像
docker push 192.168.7.131:5000/pause:v3.0
docker push 192.168.7.131:5000/coredns:v1.2
docker push 192.168.7.131:5000/dashboard:v1.8.3
docker push 192.168.7.131:5000/heapster:v1.5.1
查看仓库现有镜像
curl -XGET http://192.168.7.131:5000/v2/_catalog
{"repositories":["coredns","dashboard","heapster","pause"]}