46 lines
2.1 KiB
Markdown
46 lines
2.1 KiB
Markdown
# Gateway API and FastAPI lab
|
|
|
|
This optional lab demonstrates a GatewayClass, Gateway and HTTPRoute using a
|
|
dedicated Traefik controller and a FastAPI backend. The proxy is a ClusterIP
|
|
service; the existing Traefik deployment, Ingress resources and public routes
|
|
are untouched. The controller watches only the lab namespace and the labeled
|
|
lab GatewayClass. Gateway API CRDs are cluster-wide: Jeannie installs the
|
|
missing standard v1.5.1 CRDs and refuses unknown or different existing versions.
|
|
It does not install the release's optional admission policy or remove CRDs.
|
|
|
|
The FastAPI service exports real spans to the OpenTelemetry lab collector.
|
|
The API's `/api/info` response contains the trace ID. Jeannie verifies it reaches
|
|
Tempo, so the test needs the existing `opentelemetry-lab` application. The demo
|
|
installs its pinned direct Python dependencies from PyPI in an init container;
|
|
the node needs internet access each time a new API pod starts. This is a small
|
|
learning lab, not an offline or production image build.
|
|
|
|
From the Debian server after pushing this code to the GitOps main branch:
|
|
|
|
```sh
|
|
cd ~/my-homelab-configs
|
|
git pull --ff-only gitea main
|
|
./jeannie gateway-lab plan
|
|
./jeannie gateway-lab apply
|
|
./jeannie gateway-lab status
|
|
./jeannie gateway-lab test
|
|
```
|
|
|
|
Argo CD synchronization and the first dependency download may take a few
|
|
minutes. `test` waits for both deployments, makes a request through the Gateway,
|
|
and checks the resulting trace in Tempo. The selected Jeannie cluster profile and
|
|
its pinned identity apply to all commands. The deployment uses the configured
|
|
GitOps repository's `main` branch, so push first.
|
|
|
|
To explore the automatic FastAPI documentation from Debian:
|
|
|
|
```sh
|
|
kubectl --kubeconfig="$HOME/.kube/opi5-k3s-config" -n gateway-lab \
|
|
port-forward --address 127.0.0.1 service/gateway-lab-proxy 18080:8000
|
|
```
|
|
|
|
Open `http://gateway-lab.localhost:18080/docs` on that host; use an SSH local
|
|
port forward from another machine. Use the kubeconfig for the selected profile
|
|
if running a mixed or all-Pimox cluster. The port forward remains local and does
|
|
not publish a new external endpoint.
|