K8S发布系统-基础服务部署

接上一篇,后续操作。

Nw-Harbor虚拟机(220.138)

Harbor

部署

Harbor是由VMware公司开源的企业级的Docker Registry管理项目,项目地址:https://github.com/goharbor/harbor。安装需求:

  1. 下载离线安装包:
    wget https://github.com/goharbor/harbor/releases/download/v2.1.0/harbor-offline-installer-v2.1.0.tgz
  2. 解压:
    tar zxf harbor-offline-installer-v2.1.0.tgz -C /data/
  3. 安装Docker环境:
    yum install -y yum-utils
    yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    yum repolist
    yum install -y docker-ce
    systemctl enable docker
    systemctl start docker
    curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    chmod +x /usr/local/bin/docker-compose
    docker-compose --version
  4. 配置Harbor(配置文件说明):
    cd /data/harbor/
    cp harbor.yml.tmpl harbor.yml
    vim harbor.yml
    
    hostname: 172.16.220.138
    harbor_admin_password: Nw-Harbor123
    data_volume: /data/harbor/data
    

    将https配置注释掉,其它配置根据需要修改。

  5. 安装Harbor:
    ./prepare
    ./install.sh --with-chartmuseum

Tips: 使Docker客户机支持Harbor方法:

vim /etc/docker/daemon.json
...
{ "insecure-registries": [ "172.16.220.138:80" ] }
...
systemctl restart docker

设置服务

设置服务并开机启动:

vim /lib/systemd/system/harbor.service
[Unit]
Description=Harbor
After=docker.service systemd-networkd.service systemd-resolved.service
Requires=docker.service
Documentation=http://github.com/vmware/harbor

[Service]
Type=simple
Restart=on-failure
RestartSec=5
#需要注意harbor的安装位置
ExecStart=/usr/local/bin/docker-compose -f  /data/harbor/docker-compose.yml up
ExecStop=/usr/local/bin/docker-compose -f /data/harbor/docker-compose.yml down          

[Install]
WantedBy=multi-user.target
systemctl enable harbor
systemctl start harbor
systemctl status harbor

Nw-Gitlab主机(220.139)

Gitlab

Gitlab部署于 172.16.220.139 物理主机上。下载官方RPM安装包后默认安装即可。

  1. 下载最新版Gitlab-ce(官网页面):
    wget https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-13.5.1-ce.0.el8.x86_64.rpm/download.rpm
  2. 安装:
    rpm -ivh gitlab-ce-13.5.1-ce.0.el8.x86_64.rpm

  3. 配置
    cd /etc/gitlab
    sed -i "s/^external_url.*/external_url \'http\:\/\/172\.16\.220\.139\'/" gitlab.rb
    gitlab-ctl reconfigure
  4. 启动
    默认reconfigure后会自动启动。且设置为开机自启。
    gitlab-ctl start
    gitlab-ctl status
    systemctl status gitlab-runsvdir

  5. 访问
    首次访问需设置密码:

NFS

  1. 安装:
    yum install -y nfs-utils
  2. 设置共享目录:
    mkdir -p /data/share
    chmod o+w /data/share/
    touch /data/share/Dir_for_k8s_sharing.txt
  3. 配置:
    vim /etc/exports
    /data/share     172.16.220.0/24(sync,rw) 10.10.0.0(sync,rw)
  4. 启动
    systemctl enable nfs-server
    systemctl start nfs-server
    systemctl status nfs-server

发表评论

error: Content is protected !!