k8s 之harbor仓库安装(四)

1.200机器安装harbor仓库

[root@hdss7-200 ~]# mkdir -p /opt/src
[root@hdss7-200 ~]# cd /opt/src
[root@hdss7-200 src]# ll
total 566428
-rw-r--r-- 1 root root 580021898 Apr  1 18:46 harbor-offline-installer-v1.8.3.tgz
[root@hdss7-200 src]# tar xf harbor-offline-installer-v1.8.3.tgz -C /opt/

# 把软件包做版本标识,做一个软链接,便于以后升级
[root@hdss7-200 src]# cd ..
[root@hdss7-200 opt]# mv harbor/ harbor-v1.8.0
[root@hdss7-200 opt]# ln -s /opt/harbor-v1.8.0/ /opt/harbor
[root@hdss7-200 opt]# ll
total 0
drwxr-xr-x 2 root root  71 Jun  6 11:19 certs
drwx--x--x 4 root root  28 Jun  6 11:43 containerd
lrwxrwxrwx 1 root root  19 Jun  6 11:57 harbor -> /opt/harbor-v1.8.0/
drwxr-xr-x 2 root root 100 Jun  6 11:57 harbor-v1.8.0
drwxr-xr-x 2 root root  49 Jun  6 11:55 src
编辑harbor文件
[root@hdss7-200 opt]# cd harbor
[root@hdss7-200 harbor]# vi harbor.yml
5 hostname: harbor.od.com
10   port: 180
27 harbor_admin_password: Harbor12345
40 data_volume: /data/harbor
87     location: /data/harbor/logs  # 更改日志存储路径

[root@hdss7-200 harbor]# mkdir -p /data/harbor/logs

单机编排工具
[root@hdss7-200 harbor]# yum install -y docker-compose
[root@hdss7-200 harbor]# rpm -qa docker-compose
docker-compose-1.18.0-4.el7.noarch
安装
[root@hdss7-200 harbor]# ./install.sh 
[root@hdss7-200 harbor]# docker-compose ps

每次重启docker需要执行也可以通过脚本方式启动
[root@hdss7-200 harbor]# docker-compose up -d

image.png

2.安装nginx做反向代理

[root@hdss7-200 harbor]#  yum install -y nginx
[root@hdss7-200 harbor]# vi /etc/nginx/conf.d/harbor.od.com.conf
server {
    listen       80;
    server_name  harbor.od.com;

    client_max_body_size 1000m;

    location / {
        proxy_pass http://127.0.0.1:180;
    }
}
[root@hdss7-200 harbor]# nginx -t
[root@hdss7-200 harbor]# systemctl start nginx
[root@hdss7-200 harbor]# systemctl enable nginx

3 dns服务器配置域名

[root@hdss7-11 ~]# vi /var/named/od.com.zone 
[root@hdss7-11 ~]# cat /var/named/od.com.zone
$ORIGIN od.com.
$TTL 600    ; 10 minutes
@           IN SOA  dns.od.com. dnsadmin.od.com. (
                20200606 ; serial
                10800      ; refresh (3 hours)
                900        ; retry (15 minutes)
                604800     ; expire (1 week)
                86400      ; minimum (1 day)
                )
                NS   dns.od.com.
$TTL 60 ; 1 minute
dns                A    192.168.12.11
harbor             A    192.168.12.200
[root@hdss7-11 ~]# systemctl restart named
[root@hdss7-11 ~]# dig -t A harbor.od.com +short
192.168.12.200

image.png

新建一个public项目,公开

[root@hdss7-200 harbor]# docker pull nginx:1.7.9

[root@hdss7-200 harbor]# docker tag nginx:1.7.9 harbor.od.com/public/nginx:v1.7.9  

[root@hdss7-200 harbor]# docker login harbor.od.com

[root@hdss7-200 harbor]# docker push harbor.od.com/public/nginx:v1.7.9

原文章已同步到语雀‘

https://www.yuque.com/songyifei/bkxwl0/ihp7o5

 

 

 

posted @ 2020-06-06 12:20  地铁昌平线  阅读(604)  评论(0编辑  收藏  举报