Getting started
The gateway is configured with one YAML file. Everything reusable is defined once under Rules, then referenced by name from the scope that needs it. Pick how you run it.
-
Pull the image.
Terminal window docker pull nocleye/api-gateway:v0.6.0-beta -
Write a config. One backend, one route, and a rate limit bound to the route. Callers are identified by IP, there is no default, so the route names a client ID rule. Save it as
gateway.yamlin the current directory. The backend address points at a service on your host.gateway.yaml ApiVersion: v1BetaRules:ClientIDRules:by-ip:Modes: [IP]UsageControlRules:per-minute:RequestCount: 60WindowTime: 1mServerConfigs:my-api:URL: "http://host.docker.internal:9090"ServerRoutes:api:TargetServer: my-apiMatchOptions:PathPattern: /apiClientIDRule: by-ipUsageControlRules: [per-minute]A request to
/api/usersis forwarded tohttp://host.docker.internal:9090/api/users, and each IP address gets 60 requests per minute. -
Check it.
checkreports errors and warnings without starting the gateway. See the check reference for every message.Terminal window docker run --rm \-v "$PWD/gateway.yaml:/etc/nocleye-beta/gateway/gateway.yaml:ro" \-e GATEWAY_CONFIG_PATH=gateway.yaml \nocleye/api-gateway:v0.6.0-beta check -
Run it.
--add-hostlets the container reach your host on Linux. Every flag has an environment variable, see Command line.Terminal window docker run --rm -p 8080:8080 \--add-host=host.docker.internal:host-gateway \-v "$PWD/gateway.yaml:/etc/nocleye-beta/gateway/gateway.yaml:ro" \-e GATEWAY_CONFIG_PATH=gateway.yaml \nocleye/api-gateway:v0.6.0-beta gateway
-
Get the binary. Download the archive for your platform from Releases, unpack it, and put
nocleyeon yourPATH. -
Write a config. One backend, one route, and a rate limit bound to the route. Callers are identified by IP, there is no default, so the route names a client ID rule. The gateway reads config files from
/etc/nocleye-beta/gateway/, so save it there asgateway.yaml.gateway.yaml ApiVersion: v1BetaRules:ClientIDRules:by-ip:Modes: [IP]UsageControlRules:per-minute:RequestCount: 60WindowTime: 1mServerConfigs:my-api:URL: "http://localhost:9090"ServerRoutes:api:TargetServer: my-apiMatchOptions:PathPattern: /apiClientIDRule: by-ipUsageControlRules: [per-minute]A request to
/api/usersis forwarded tohttp://localhost:9090/api/users, and each IP address gets 60 requests per minute. -
Check it.
nocleye checkreports errors and warnings without starting the gateway. See the check reference for every message.Terminal window nocleye check --gConfigPath gateway.yaml -
Run it. Every flag has an environment variable, see Command line.
Terminal window nocleye gateway --gConfigPath gateway.yaml --gPort 8080
The lab is a local k3d cluster with the gateway in front of two apps (httpbin over HTTP and podinfo over TLS), plus Prometheus, Grafana and a Locust traffic job. It is for exploring a running setup, not for learning the config step by step.
-
Get the lab. Install k3d (required) and
kubectl, then clone the repository.Terminal window git clone https://github.com/nocleye/api-gateway.gitcd api-gateway/lab -
Start it. This creates the cluster and deploys everything. Run it again to re-apply changes. Set
GW_IMAGEto use another image.Terminal window ./up.shGW_IMAGE=nocleye/api-gateway:<tag> ./up.sh -
Open it.
What URL Gateway http://localhost:8501 Support server http://localhost:8581 Prometheus http://localhost:9590 Grafana http://localhost:3500 Grafana has the “Gateway k8s Observability Lab” dashboard.
-
Send traffic. A Locust job runs inside the cluster and prints its summary when done. The classes are
SteadyUser,ErrorsUser,RateLimitUser,AuthUserandScannerUser.Terminal window ./traffic.sh # 20 users, 60s, all classes./traffic.sh -t 2m AuthUser RateLimitUser./traffic.sh -u 300 -r 100 -t 30s SteadyUser # spike -
Change it and clean up. Edit
config/gateway.yamland run./up.shagain, the affected pods roll. Delete the cluster when you are done.Terminal window kubectl -n nocleye-obs get podskubectl -n nocleye-obs logs -f -l app=gateway --prefix./down.sh
- How requests are handled: the order the gateway applies routing, limits and auth.
- Servers and routes: path rewriting and HTTPS backends.
- Logs and metrics: the access log and Prometheus.
