Kubernetes – Harbor(最新2.3)

  • Post author:
  • Post category:其他




①环境准备

'//前期优化'
[root@localhost ~]# hostnamectl set-hostname harbor
[root@localhost ~]# su
[root@harbor ~]# echo "192.168.126.11 master
> 192.168.126.12 node01
> 192.168.126.13 node02
> 192.168.126.14 harbor" >> /etc/hosts
[root@harbor ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.126.11 master
192.168.126.12 node01
192.168.126.13 node02
192.168.126.14 harbor		'//去另外三台机器添加harbor'



②一键脚本

'//刷一键脚本'
[root@harbor ~]# vim /opt/ku.sh

#----禁用防火墙及Selinux----
systemctl stop firewalld && systemctl disable firewalld
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config

#----安装docker----
#安装一些必要的系统工具以支持;
yum install -y yum-utils device-mapper-persistent-data lvm2
sleep 2s

#安装源,添加软件源信息;
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sleep 2s

#安装docker;
yum makecache fast
yum -y install docker-ce

#重载参数并重启docker以生效。
systemctl start docker && systemctl enable docker
systemctl daemon-reload && systemctl restart docker

#----安装docker compose----
curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

#----安装harbor----
curl -L https://github.com/goharbor/harbor/releases/download/v2.3.0-rc1/harbor-offline-installer-v2.3.0-rc1.tgz -o /usr/local/harbor-offline-installer-v2.3.0.tgz


--
[root@harbor ~]# . /opt/ku.sh
...
...



③Harbor 配置

[root@harbor ~]# cd /usr/local/
[root@harbor local]# tar zxvf harbor-offline-installer-v2.3.0.tgz 
harbor/harbor.v2.3.0-build.695.tar.gz
harbor/prepare
harbor/LICENSE
harbor/install.sh
harbor/common.sh
harbor/harbor.yml.tmpl
[root@harbor local]# cd harbor/
[root@harbor harbor]# ls
common.sh                       harbor.yml.tmpl  LICENSE
harbor.v2.3.0-build.695.tar.gz  install.sh       prepare
[root@harbor harbor]# mv harbor.yml.tmpl harbor.yml
[root@harbor harbor]# vim harbor.yml 

5 hostname: 192.168.126.14		'//本机IP'
13 #https:		'//新版本需注释掉https,不然安装过程会报错!'
15 #  port: 443

[root@harbor harbor]# ./install.sh 
...
...
[Step 5]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-portal ... done
Creating redis         ... done
Creating registryctl   ... done
Creating registry      ... done
Creating harbor-db     ... done
Creating harbor-core   ... done
Creating harbor-jobservice ... done
Creating nginx             ... done
✔ ----Harbor has been installed and started successfully.----

'//打开浏览器访问【192.168.126.14】'



④访问 Web 页面

mark
mark




⑤其他

后续新建项目、C/S端测试上传拉取镜像等不再掩饰;

相关链接:

https://xucf1.blog.csdn.net/article/details/115306551




版权声明:本文为weixin_51486343原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。