This page looks best with JavaScript enabled

Unlimited Uses, Up to 6 Hours Per Session: Free Online Kubernetes Experience

 ·  ☕ 2 min read

1. Log in to Ngrok and get an Authtoken

1.1 Log in to the Ngrok website and get an Authtoken

Visit the Ngrok website, https://dashboard.ngrok.com/ , and log in with a GitHub or Google account.

Go to the Authentication page and find your Authtoken, as shown below:

1.2 Configure Secrets under the GitHub project

On the project’s Settings page, add a new Secret, as shown below:

Set NGROK_TOKEN to the Authtoken obtained in the previous step.

2. Add a Workflow in GitHub Actions and run the Action

To make Kubernetes easier to use, KubeSphere is pre-installed here to manage the cluster.

Add the following file under the project’s .github/workflows directory:

kubernetes.yaml

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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: 60
        continue-on-error: true
        with:
          ngrok_token: ${{ secrets.NGROK_TOKEN }}
          ngrok_addr_1: 30880
          ngrok_proto_1: http

The timeout-minutes parameter determines how long you can use the environment; the maximum is no more than 6 hours, after which the environment is destroyed. It is set to 60 minutes here.

On the Actions page, click to run the Action.

To see the full log, click into the Action after it finishes and view the streaming log; otherwise you may not see the relevant links. You need to log in to the Ngrok Dashboard and visit the https://dashboard.ngrok.com/status/tunnels page to check:

3. Access KubeSphere

You can find the relevant access links in the Action’s execution log.

Use ssh root@4.tcp.ngrok.io -p 19315 to log in to the backend; the password is root.

After waiting about 7 minutes for the Action to run, both https://ce382ad6a3d1.ngrok.io/ and http://ce382ad6a3d1.ngrok.io/ can open the KubeSphere management page. Below are screenshots of the product pages:


WeChat Official Account
WRITTEN BY
WeChat Official Account