Skip to content

buildstar-online/unity-webgl-nginx

Repository files navigation

WebGL on Kubernetes

Resources and Workflows to build & deploy Unity3D WebGL builds using
GameCI, Kubernetes and ArgoCD.

Demo site webgl-nginx.buildstar.online


Screenshot 2023-05-10 at 08 17 15
Screenshot 2023-05-10 at 08 25 04

Contents

Workflows:

Screenshot 2023-08-15 at 14 47 34

Screenshot 2023-08-15 at 14 47 49

Templates:

Requirements

You will need either a Kubernetes cluster running ArgoCD and the Kubernetes Ingress-Nginx controller, a virtual machine, or a bare-metal host.

If you do not have any of those available, the following resources can guide you through using Terraform to create one using various cloud providers.

k3s Quick Start

I advise using K3s as it's very easy to deploy on Bare Metal and VMs as Single-Node cluster. This example shows a minimum-viable deployment.

  1. Download and install K3s

    curl -sfL https://get.k3s.io | sh - 
  2. Wait for node to be ready

    sudo k3s kubectl get node
    NAME   STATUS   ROLES                  AGE   VERSION
    vm0    Ready    control-plane,master   1m   v1.27.4+k3s1
  3. Create the deployment and expose the service with a load-balancer

    sudo kubectl create -f https://raw.githubusercontent.com/buildstar-online/unity-webgl-nginx/main/kubernetes/default-k3s-deployment.yaml
  4. Get the External-IP and port for the service

    sudo kubectl get svc -n webgl-nginx
    NAME                  TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)          AGE
    webgl-nginx-service   LoadBalancer   10.43.113.106   192.168.50.101   8080:30262/TCP   22m
  5. Vist the site in your browser at http://<external-ip>:8080/

  6. Cleanup

    /usr/local/bin/k3s-uninstall.sh