离线安装

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

前提

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

准备离线镜像和安装包

在有网络的环境下提前准备好 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.17.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}/rainbond-operator:${VERSION}
  18. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-worker:${VERSION}
  19. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-node:${VERSION}
  20. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-monitor:${VERSION}
  21. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-gateway:${VERSION}
  22. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-api:${VERSION}
  23. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/rbd-db:8.0.19
  24. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/mysqld-exporter:latest
  25. ${IMAGE_DOMAIN}/${IMAGE_NAMESPACE}/nfs-provisioner:latest"
  26. for image in ${image_list}; do
  27. docker pull "${image}"
  28. done
  29. docker save -o rainbond-"${VERSION}".tar ${image_list}

获取 Rainbond Helm Chart 安装包

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

开始安装

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

导入镜像包

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

安装 Rainbond

解压 Helm Chart 包

  1. tar xvf rainbond-cluster-5.16.0.tgz

使用 Helm Chart 安装 Rainbond

离线安装 - 图1info

当需要对接自建的镜像仓库、数据库、ETCD、共享存储、指定网关节点、指定构建节点等。你可以参考 values.yaml 详解 并修改下述命令。

  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

安装进度查询

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

  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

访问平台

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

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

离线环境下使用源码构建(可选)

获取镜像

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

vim download_rbd_images_sourcebuild.sh

  1. #!/bin/bash
  2. VERSION=${VERSION:-'v5.17.0-release'}
  3. image_list="registry.cn-hangzhou.aliyuncs.com/goodrain/buildkit:latest
  4. registry.cn-hangzhou.aliyuncs.com/goodrain/builder:${VERSION}
  5. registry.cn-hangzhou.aliyuncs.com/goodrain/runner:${VERSION}"
  6. for image in ${image_list}; do
  7. docker pull "${image}"
  8. done
  9. docker save -o rainbond-sourcebuild-"${VERSION}".tar ${image_list}

下载 rbd-resource-proxy 镜像离线包

  1. wget https://pkg.rainbond.com/offline/5.3-enterprise/rbd-resource-proxy-offline-amd64.tar

导入镜像

将镜像包导入到目标服务器

  1. docker load -i rainbond-sourcebuild-v5.17.0-release.tar
  2. docker load -i rbd-resource-proxy-offline-amd64.tar

推送镜像

Rainbond 安装成功后推送 builder runner rbd-resource-proxy 镜像到 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.16.0-release goodrain.me/builder:latest-amd64
  7. docker tag registry.cn-hangzhou.aliyuncs.com/goodrain/runner:v5.16.0-release goodrain.me/runner:latest-amd64
  8. docker push goodrain.me/builder:latest-amd64
  9. docker push goodrain.me/runner:latest-amd64
  10. docker push goodrain.me/rbd-resource-proxy:offline-amd64

升级 Rainbond

使用 Helm 升级 Rainbond,重新指定 rbd-resource-proxy 镜像

  1. helm upgrade rainbond ./rainbond-cluster -n rbd-system \
  2. --set Cluster.enableEnvCheck=false \
  3. --set Component.rbd_app_ui.env.DISABLE_DEFAULT_APP_MARKET=true \
  4. --set Component.rbd_resource_proxy.image=goodrain.me/rbd-resource-proxy:offline-amd64