A single binary toolkit to manage HTTP and gRPC reverse proxy records on Kubernetes. It provides:
- Server: runs in-cluster, listens on HTTP
:80and gRPC:50051, routes incoming requests via dynamicIngressandSecretresources. - HTTP API: REST endpoints (
/api/prx) to create, update, delete, list redirects using JWT authentication. - gRPC API:
Reverseservice withAdd,Update,Delete,ListRPCs, secured by the same JWT. - CLI client: one binary
prxexposes subcommands:prx secret(Bubble Tea UI): generates a new HMAC key for JWT signing.prx auth(Bubble Tea UI): generates a JWT for client authentication.prx add/update/delete/list: gRPC client to configure proxies.
- Project Overview
- Architecture
- Prerequisites
- Setup & Configuration
- Running Locally
- Deployment
- Usage
- GitHub Workflow
- License
prx is designed to let operators dynamically manage reverse proxy rules in a Kubernetes cluster. It:
- Automates creation of TLS
SecretandIngressper hostname. - Stores redirect-to URLs in a
ConfigMapfor fallback and listing. - Secures all configuration operations behind JWT-based auth.
- Offers both REST and gRPC interfaces.
- Ships a user-friendly CLI, including TUI modes for secret & token generation.
Use cases:
- Multi-tenant ingress management without manual YAML.
- Dynamic redirects for legacy hostnames.
- Automated certificate & ingress lifecycle.
┌────────────┐
│ HTTP API │<─── JWT bearer token
| |--------------┐
└────────────┘ │
│ HandleAddNewProxy │
┌────────┐ │ HandleDeleteProxy │ ┌───────────┐
│ CLI │───┼ HandleGetRecords │ │ Kubernetes│
│ prx │ │ HandlePatchProxy │ │ cluster │
└────────┘ └────────┬─────────────┘ └───────────┘
Uses Kube Client Creates Secrets, Ingress, ConfigMap
and JWT Service
│
▼
┌──────────┐
│ gRPC API │
└──────────┘
- Server (
cmd/server/main.go): starts HTTP server on port 80 and gRPC on 50051. - Kubernetes Client (
internal/services/kubectl.go): applies/deletesSecret,Ingress,ConfigMap. - Persistence: in-memory map +
ConfigMapfallback. - Auth:
JWTServicesigns tokens, validated by middleware and interceptor.
- Go ≥1.20
protoc+protoc-gen-go+protoc-gen-go-grpc- Kubernetes cluster (v1.24+) with
IngressController - Docker (for building image)
- Helm v3 (for deployment chart)
-
Clone the repo:
git clone https://github.com/TypeTerrors/go_proxy.git cd go_proxy -
Generate gRPC code:
cd proto protoc --go_out=. --go-grpc_out=. reverse.proto -
Build binaries:
go build -o prx-server ./cmd/server go build -o prx ./cmd/client
-
Environment Variables for server:
NAMESPACE– Kubernetes namespace to manage.JWT_SECRET– base64 HMAC key (useprx secret).PRX_KUBE_CONFIG– optional base64 kubeconfig override.
-
Generate secret:
prx secret
-
Get a JWT:
prx auth --secret YOUR_GENERATED_SECRET
-
Run server:
export NAMESPACE=default export JWT_SECRET=... kubectl port-forward svc/my-ingress-controller 80:80 & ./prx-server
-
Test HTTP API:
curl -H "Authorization: Bearer $JWT" \ -d '{"from":"example.com","to":"http://1.2.3.4","cert":"...","key":"..."}' \ http://localhost/api/prx
-
Test gRPC:
prx add --addr localhost:50051 \ --token $JWT --from example.com --to http://1.2.3.4 \ --cert tls.crt --key tls.key prx list --addr localhost:50051 --token $JWT
We use GitHub Actions to build, tag, push Docker image and deploy via Helm.
- Docker image built and tagged
ghcr.io/typeterrors/go_proxy:<tag>, latest. - Kubernetes setup: ServiceAccount
prx-userwith non-expiring token, Role/RoleBinding for secrets, ingresses, configmaps. - Generate kubeconfig for CLI users and set
PRX_KUBE_CONFIGin Helm values. - Helm Chart in
./charts/go-proxy:helm upgrade --install go-proxy ./charts/go-proxy \ --namespace $NAMESPACE \ --set application.image.repository=ghcr.io/typeterrors/go_proxy \ --set application.image.tag=<tag> \ --set application.JWT_SECRET=$JWT_SECRET \ --set global.PRX_KUBE_CONFIG=$KUBECONFIG_B64
- List records:
curl -H "Authorization: Bearer $JWT" http://<host>/api/prx
- Add record:
curl -X POST -H "Authorization: Bearer $JWT" \ -H "Content-Type: application/json" \ -d '{"from":"foo.com","to":"http://1.2.3.4","cert":"$(base64 tls.crt)","key":"$(base64 tls.key)"}' \ http://<host>/api/prx
- Add:
prx add \ --addr proxy.mydomain:50051 \ --token $JWT \ --from example.com \ --to http://1.2.3.4 \ --cert tls.crt \ --key tls.key - List:
prx list --addr proxy:50051 --token $JWT
The BuildPushDeploy action triggers on PR to main/dev:
- Checkout, get short SHA + PR number ⇒
<tag>. - Build
/go_proxy.dockerfilewithVERSION=<tag>, push to GHCR. - Create GitHub release.
- Setup
kubectl&helm. - Configure cluster with
prx-userSA, Role, RoleBinding. - Generate and encode kubeconfig for CLI users.
- Create imagePullSecret & TLS secret for ingress.
- Run
helm upgrade --install go-proxy ....