infra(k8s): add Kubernetes manifests for api, app, processing, and postgres#286
Merged
Xhristin3 merged 1 commit intoJun 17, 2026
Merged
Conversation
…stgres Adds a new `k8s/` directory containing deployable manifests for every runtime component of the platform: - Namespace + ResourceQuota (`00-namespace.yaml`) - Postgres StatefulSet with PVC and a ConfigMap-loaded init script from `database/schema.sql` (`10-postgres.yaml`) - API Deployment, Service, ConfigMap and Secret template (`20-api.yaml`) - Next.js App Deployment, Service and ConfigMap (`30-app.yaml`) - Stream-processing worker Deployment, Service and ConfigMap (`40-processing.yaml`) - Ingress routing external traffic to app + api (`60-ingress.yaml`) - Kustomize entrypoint (`kustomization.yaml`) and a deployment README (`README.md`). To support kubelet liveness/readiness probes the API gains a /livez route that does not touch the database (liveness must never trigger a restart loop on a transient DB outage). The processing worker exposes /livez (always 200) and /healthz (503 once shutdown begins) on the existing metrics server, and that server is now wired into the worker startup and GracefulShutdown so the listening socket is closed promptly on SIGTERM. The Next.js app gains a lightweight /api/health route that bypasses the project middleware. Probes, resource requests/limits, and ConfigMap vs Secret separation all map to issue XStreamRollz#217's acceptance criteria. Closes XStreamRollz#217
Xhristin3
approved these changes
Jun 17, 2026
Xhristin3
left a comment
Contributor
There was a problem hiding this comment.
Big +1 from me. Decoupling liveness (/livez) from readiness (/healthz) is exactly right — prevents restart loops on transient DB blips. GracefulShutdown drain + 503 in healthz is nice. README walkthrough is helpful. README clearly documents the CHANGEME-* secrets — please remember to replace them before any non-dev apply 🚢
5 tasks
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.
Summary
Resolves #217 by adding a complete
k8s/deployment for the XStreamRoll platform (api, app, processing, postgres) with liveness/readiness probes, ConfigMap/Secret separation, resource requests+limits, and runtime images pulled fromghcr.io/xstreamrollz/xstreamroll-{api,app,processing}.Files added
k8s/00-namespace.yaml— Namespace + ResourceQuotak8s/10-postgres.yaml— StatefulSet, headless Service, PVC, Secret template, init-script ConfigMap mountk8s/20-api.yaml— Deployment, Service, ConfigMap, Secret template, probesk8s/30-app.yaml— Deployment, Service, ConfigMap, probesk8s/40-processing.yaml— Deployment, Service, ConfigMap, probesk8s/60-ingress.yaml— Ingress routing rulesk8s/kustomization.yaml— Kustomize entrypoint withdisableNameSuffixHashfor stable ConfigMap namesk8s/README.md— Deploy + secret-substitution + verification commandsFiles modified
api/src/health/health.controller.ts— newGET /health/livez(DB-free liveness probe)xstreamroll-processing/src/metrics.ts— new/livezand/healthzroutesxstreamroll-processing/src/worker.ts— metrics server wired into startup + GracefulShutdownxstreamroll-processing/__tests__/metrics.test.ts— 3 new tests for the health endpointsFiles created
app/src/app/api/health/route.ts— Next.js/api/healthroute handlerAcceptance criteria coverage
imagePullPolicy: Alwayson the GHCR-published images)/livezfor liveness → restart-free,/healthor/healthzfor readiness → traffic-aware)NODE_ENV,CORS_ORIGIN,PORT,POLL_INTERVAL_MS, etc.); Secrets hold sensitive values only (POSTGRES_PASSWORD,JWT_SECRET,STREAM_API_KEY,DATABASE_URL)secretKeyRef, onlyCHANGEME-*placeholders committedHow to verify locally
Notes for reviewers
k8s/10-postgres.yamlandk8s/20-api.yamlship secret templates withCHANGEME-*placeholders. Real credentials must be substituted per environment usingkubectl create secret generic … --dry-run=client -o yaml | kubectl apply -f -(commands documented ink8s/README.md).app/Dockerfileandxstreamroll-processing/Dockerfiledeclare non-root users (appuser/appgroup);k8s/30-app.yamlandk8s/40-processing.yamlmatch withrunAsUser: 1000.api/Dockerfiledoes not yet drop privileges, sok8s/20-api.yamlcarriesrunAsNonRoot: falsewith an inline comment — flagged as follow-up hardening.Closes #217