k8s-创建harbor私有镜像仓库

k8s-创建harbor私有镜像仓库_第1张图片

#tar zxvf harbor-offline-installer-v1.4.0.tgz

#mv harbor/ /opt

#mkdir /data/harbor
#用来保存harbor的文件和目录
修改配置文件
#cd /opt/harbor

#vim harbor.cfg

hostname = reg.yunwei.edu

ui_url_protocol = https

ssl_cert = /data/harbor/cert/server.crt

ssl_cert_key = /data/harbor/cert/server.key

secretkey_path = /data/harbor

harbor_admin_password = admin

#vim docker-compose.clair.yml

volumes:
      - /data/harbor/clair-db:/var/lib/postgresql/data:z

#vim docker-compose.notary.yml

 volumes:
      - /data/harbor/notary-db:/var/lib/mysql:z

#vim docker-compose.yml

 volumes:
      #- /var/log/harbor/:/var/log/docker/:z

      - /data/harbor/:/var/log/docker/:z

volumes:
      - /data/harbor/registry:/storage:z

volumes:
      - /data/harbor/database:/var/lib/mysql:z

volumes:
      - /data/harbor/config/:/etc/adminserver/config/:z
      - /data/harbor/secretkey:/etc/adminserver/key:z
      - /data/harbor/:/data/:z

volumes:
      - ./common/config/ui/app.conf:/etc/ui/app.conf:z
      - ./common/config/ui/private_key.pem:/etc/ui/private_key.pem:z
      - ./common/config/ui/certificates/:/etc/ui/certificates/:z
      - /data/harbor/secretkey:/etc/ui/key:z
      - /data/harbor/ca_download/:/etc/ui/ca/:z
      - /data/harbor/psc/:/etc/ui/token/:z
volumes:
      - /data/harbor/job_logs:/var/log/jobs:z
      - ./common/config/jobservice/app.conf:/etc/jobservice/app.conf:z
      - /data/harbor/secretkey:/etc/jobservice/key:z

#cd /root/docker/kubernetes

#tar zxvf ca.tar.gz

#mv ca /data/harbor/cert

#vim /opt/harbor/harbor.cfg

ssl_cert = /data/harbor/cert/harbor.crt
ssl_cert_key = /data/harbor/cert/harbor.key 

安装harbor程序

#sh /opt/harbor/install.sh

k8s-创建harbor私有镜像仓库_第2张图片

k8s-创建harbor私有镜像仓库_第3张图片

 

各个节点设置登录harbor私有镜像仓库

部署节点

#mkdir /etc/docker/certs.d/reg.yunwei.edu/ -p

#cp /data/harbor/cert/ca.crt /etc/docker/certs.d/reg.yunwei.edu/


#scp /data/harbor/cert/ca.crt pikachu2:/etc/docker/certs.d/reg.yunwei.edu/
#scp /data/harbor/cert/ca.crt pikachu3:/etc/docker/certs.d/reg.yunwei.edu/
#scp /data/harbor/cert/ca.crt pikachu4:/etc/docker/certs.d/reg.yunwei.edu/

所有节点修改域名解析

k8s-创建harbor私有镜像仓库_第4张图片

k8s-创建harbor私有镜像仓库_第5张图片

上传镜像到私有仓库

先修改镜像的名字
#docker tag httpd:latest reg.yunwei.edu/test/httpd:latest
上传
#docker push reg.yunwei.edu/test/httpd:latest
节点下载镜像
#docker pull reg.yunwei.edu/test/httpd:latest

docker-compose 

同时启动多个容器,这些容器相互关联

#cd /opt/harbor/
#在docker-compose.yml文件的当前目录下

#docker-compose ps

删除
#docker-compose stop
移除已经停止的容器
#docker-compose rm

#docker-compose up -d docker-compose.yml

 

 

你可能感兴趣的:(k8s,云计算)