• 精华帖安装部署
  • 无需提前准备服务器,使用 GitHub Actions 和 Kind 等待 7 分钟快速体验 KubeSphere

登录 Ngrok 获取一个 Authtoken

登陆 Ngrok 官网,获取 Authtoken

访问 Ngrok 官网,https://dashboard.ngrok.com/ , 可以使用 GitHub 或者 Google 账户登陆。

进入 Authentication 页面,找到自己的 Authtoken,如下图:

在 GitHub 项目下,配置 Secrets

在项目的 Settings 页面中,新增 Secrets,如下图:

将 NGROK_TOKEN 设置为上一步中获取到的 Authtoken 。

在 GitHub Actions 中添加一个 workflows,并运行 Action

在项目的 .github/workflows 目录下添加如下文件:

name: example-ngrok-kind-v2
on:
  workflow_dispatch:

jobs:
  example-ngrok-kind-v2:
    runs-on: ubuntu-latest
    steps:
      - name: Creating kind cluster
        uses: helm/kind-action@v1.0.0-rc.1
      - name: Install KubeSphere
        run: |
          kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/kubesphere-installer.yaml
          kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/cluster-configuration.yaml
      - name: Expose Port for Kind
        run: |
          export ID=`docker ps | awk '{print $1}' | sed -n '2p'`
          export IP=`docker inspect ${ID} |grep IPAddress | sed -n '2p'| grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'`
          sudo apt-get install socat
          socat TCP4-LISTEN:30880,reuseaddr,fork TCP4:${IP}:30880 &

      - uses: shaowenchen/debugger-action@v2
        name: debugger
        timeout-minutes: 300
        continue-on-error: true
        with:
          ngrok_token: ${{ secrets.NGROK_TOKEN }}
          ngrok_addr_1: 30880
          ngrok_proto_1: http

其中的 timeout-minutes 参数决定了可以体验的时长,最长不超过 6 个小时,会被销毁。

在 Actions 页面中,点击运行 Action

访问 KubeSphere

在 Action 的执行日志中可以查看到相关的访问链接

这里的 https://232715dd91bc.ngrok.io/http://232715dd91bc.ngrok.io/ 都可以用来访问 KubeSphere。

使用 ssh root@4.tcp.ngrok.io -p 14656 密码 root 可以登录后台。

大约需要等待 Actions 执行 7 分钟时,上面的链接地址将可以打开。

OK,enjoy it!

参考链接

经过测试使用自己的 host 集群,能够添加 GitHub Actions 创建的集群,搭建多集群环境。

在多集群环境下,能对 member 集群进行管理,创建负载。如果需要暴露服务,需要在 socat 中添加新的端口映射,并添加 debugger-action 的端口映射。

等待时间太长了,有么有快一点的方法

zzhzzhzzh

用不了7 分钟,就创建出来了。

执行完了就进入日志滚动页面,github 页面有 bug。执行到 debugger 之后再进去,有可能查看不到日志,找不到访问链接了。这种情况只能去 ngrok 页面,查找访问链接。

还有一个需要注意的地方,xshell 无法登陆后台,请使用其他 shell 工具。