离线安装

本文档介绍通过 Helm 离线安装 Rainbond。

前提

  • 安装 Helm CLI
  • 可用的 Kubernetes 集群,版本 1.16+

1. 准备离线镜像和安装包

在有网络的环境下提前准备好 Rainbond 所需的镜像。你可以通过以下脚本下载所需的镜像。

vim download_rbd_images.sh

  1. #!/bin/bash
  2. IMAGE_DOMAIN=${IMAGE_DOMAIN:-registry.cn-hangzhou.aliyuncs.com}
  3. IMAGE_NAMESPACE=${IMAGE_NAMESPACE:-goodrain}
  4. VERSION=${VERSION:-'v5.11.0-release'}
  5. image_list="${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/kubernetes-dashboard:v2.6.1
  6. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/registry:2.6.2
  7. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/metrics-server:v0.4.1
  8. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/etcd:v3.3.18
  9. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/metrics-scraper:v1.0.4
  10. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rainbond:${VERSION}-allinone
  11. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-mesh-data-panel:${VERSION}
  12. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-webcli:${VERSION}
  13. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-eventlog:${VERSION}
  14. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-init-probe:${VERSION}
  15. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-chaos:${VERSION}
  16. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-mq:${VERSION}
  17. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/resource-proxy:v5.10.0-release
  18. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rainbond-operator:${VERSION}
  19. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-worker:${VERSION}
  20. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-node:${VERSION}
  21. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-monitor:${VERSION}
  22. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-gateway:${VERSION}
  23. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-api:${VERSION}
  24. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-db:8.0.19
  25. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/builder:${VERSION}
  26. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/runner:${VERSION}
  27. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/mysqld-exporter:latest
  28. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/nfs-provisioner:latest
  29. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/helm-env-checker:latest
  30. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/kaniko-executor:latest"
  31. for image in ${image_list}; do
  32. docker pull "${image}"
  33. done
  34. docker save -o rainbond-"${VERSION}".tar ${image_list}

获取 nfs-utils 安装包

  1. wget https://pkg.rainbond.com/offline/nfs-client/nfs_all.tar.gz

获取 Rainbond Helm Chart 安装包

  1. helm repo add rainbond https://openchart.goodrain.com/goodrain/rainbond
  2. helm pull rainbond/rainbond-cluster

2. 开始安装

导入上面准备镜像包和离线包到目标所有服务器,执行以下命令开始安装。

安装 nfs 客户端

  1. # 解压 nfs 压缩包
  2. mkdir -p /opt/nfs
  3. tar xvf nfs_all.tar.gz -C /opt/nfs
  4. # centos
  5. tar xvf /opt/nfs/basic_centos7.tar.gz -C /opt/nfs && rpm -Uvh --force --nodeps /opt/nfs/*.rpm
  6. # ubuntu
  7. export version_codename=cat /etc/os-release |grep VERSION_CODENAME|awk -F"=" '{print $2}'
  8. tar xvf /opt/nfs/basic_$version_codename.tar.gz -C /opt/nfs/ && dpkg -i /opt/nfs/*.deb

导入镜像包

  1. docker load -i rainbond-v5.11.0-release.tar

安装 Rainbond

解压 Helm Chart 包

  1. tar xvf rainbond-cluster-5.11.0.tgz

使用 Helm Chart 安装 Rainbond,

  1. kubectl create namespace rbd-system
  2. helm install rainbond ./rainbond-cluster -n rbd-system \
  3. --set Cluster.enableEnvCheck=false \
  4. --set Component.rbd_app_ui.env.DISABLE_DEFAULT_APP_MARKET=true \
  5. --set Component.rbd_resource_proxy.image=registry.cn-hangzhou.aliyuncs.com/goodrain/resource-proxy:v5.10.0-release

3. 安装进度查询

执行完安装命令后,在集群中执行以下命令查看安装状态。

  1. watch kubectl get po -n rbd-system

当名称包含 rbd-app-ui 的 Pod 为 Running 状态时即安装成功。如下所示,Pod rbd-app-ui-669bb7c74b-7bmlf 为 Running 状态时,表示 Rainbond 安装成功。

安装结果

  1. NAME READY STATUS RESTARTS AGE
  2. nfs-provisioner-0 1/1 Running 0 14d
  3. rbd-etcd-0 1/1 Running 0 14d
  4. rbd-hub-64777d89d8-l56d8 1/1 Running 0 14d
  5. rbd-gateway-76djb 1/1 Running 0 14d
  6. dashboard-metrics-scraper-7db45b8bb4-tcgxd 1/1 Running 0 14d
  7. rbd-mq-6b847d874b-j5jg2 1/1 Running 0 14d
  8. rbd-webcli-76b54fd7f6-jrcdj 1/1 Running 0 14d
  9. kubernetes-dashboard-fbd4fb949-2qsn9 1/1 Running 0 14d
  10. rbd-resource-proxy-547874f4d7-dh8bv 1/1 Running 0 14d
  11. rbd-monitor-0 1/1 Running 0 14d
  12. rbd-db-0 2/2 Running 0 14d
  13. rbd-eventlog-0 1/1 Running 0 14d
  14. rbd-app-ui-669bb7c74b-7bmlf 1/1 Running 0 7d12h
  15. rbd-app-ui-migrations--1-hp2qg 0/1 Completed 0 14d
  16. rbd-worker-679fd44bc7-n6lvg 1/1 Running 0 9d
  17. rbd-node-jhfzc 1/1 Running 0 9d
  18. rainbond-operator-7978d4d695-ws8bz 1/1 Running 0 9d
  19. rbd-chaos-nkxw7 1/1 Running 0 8d
  20. rbd-api-5d8bb8d57d-djx2s 1/1 Running 0 47h

4. 访问平台

复制如下命令,在集群中执行,可以获取到平台访问地址。如果有多个网关节点,则任意一个地址均可访问到控制台。

  1. kubectl get rainbondcluster rainbondcluster -n rbd-system -o go-template --template='{{range.spec.gatewayIngressIPs}}{{.}}:7070{{printf "\n"}}{{end}}'

推送镜像至私有仓库

Rainbond 安装成功后推送 builder runner 镜像到 Rainbond 私有仓库

  1. # 获取镜像仓库密码
  2. kubectl get rainbondcluster -n rbd-system -o yaml|grep -A 3 imageHub
  3. # 登陆仓库
  4. docker login -u admin goodrain.me -p <password>
  5. # 重新打 tag 并推送镜像
  6. docker tag registry.cn-hangzhou.aliyuncs.com/goodrain/builder:v5.11.0-release goodrain.me/builder:latest
  7. docker tag registry.cn-hangzhou.aliyuncs.com/goodrain/runner:v5.11.0-release goodrain.me/runner:latest
  8. docker push goodrain.me/builder:latest
  9. docker push goodrain.me/runner:latest

5. 自定义高级配置(可选)

当你有一些额外需求,比如使用自建的镜像仓库、数据库、ETCD、StorageClass、指定网关节点、指定构建节点等。你可以使用Helm安装命令生成工具生成安装命令。 参数详细说明可以参考 values.yaml 详解