登录 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!
参考链接