Add Kubernetes Deployment Infrastructure#117
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #87
Summary
Implements a complete Kubernetes deployment solution for the go-towerfall application stack (backend, frontend, and bot2) with Cloudflare Tunnel integration for external access. The deployment uses templated manifests with environment variable substitution, supports both Windows and Linux/Mac development environments, and includes automated Task commands for streamlined cluster setup and management.
Changes Made
k8s/ Directory Structure
templates/directorynamespace.yaml- towerfall namespacesecrets/cloudflare-tunnel.yaml- Cloudflare tunnel credentialsconfigmaps/- frontend config.js and cloudflared routing configurationservices/- ClusterIP services for backend (port 4000) and frontend (port 4001)deployments/- backend, frontend, bot2, and cloudflared deploymentsinstall.shandinstall.ps1scripts for cross-platform manifest generation using envsubst.env.exampletemplate with all required environment variablesREADME.mdwith step-by-step deployment instructions for local kind clustersbot2/ Python Project
Dockerfilewith CUDA runtime base for GPU supporthttp://localhost:4000for local development, overridable viaGAME_SERVER_HTTP_URLandGAME_SERVER_WS_URLTaskfile.yml
k8s:install-envsubsttask for Windows envsubst installation via Gok8s:install-kindtask for local Kubernetes cluster setupk8s:cluster-create,k8s:cluster-destroyfor cluster lifecycle managementk8s:build-loadto rebuild all Docker images and load into kind clusterk8s:deployto generate and apply manifests using install scriptsk8s:cluster-setupfor one-command cluster creation and full deploymentk8s:logsandk8s:statusfor monitoring deployed resourcesImplementation Details
Manifest Templating
${VARIABLE}placeholders for environment-specific valuesinstall.sh(bash) andinstall.ps1(PowerShell) process templates using envsubstgenerated/directory (gitignored)CF_TUNNEL_ID,CF_ACCOUNT_TAG,CF_TUNNEL_SECRET,API_DOMAIN,FRONTEND_DOMAIN,IMAGE_REGISTRYFrontend Configuration
config.jswss://${API_DOMAIN}andhttps://${API_DOMAIN}/healthendpoint for readiness/liveness probesCloudflare Tunnel Routing
${API_DOMAIN}→ backend-service:4000 (WebSocket + REST API)${FRONTEND_DOMAIN}→ frontend-service:4001 (static frontend)Local Development with kind
IMAGE_REGISTRY=towerfallfor local developmentkind load docker-imageimagePullPolicy: IfNotPresentto use loaded imagestask k8s:build-loadTesting
Additional Notes
/healthendpoint for Kubernetes probestask k8s:install-envsubstbefore using deployment scripts.envfile excluded from git; users must copy.env.exampleand configure with their Cloudflare credentials