Skip to content

Support deploying on standard Kubernetes (KIND) and multi-arch builds (amd64 + arm64) #96

@anfredette

Description

@anfredette

Context

NeuralNav's Kubernetes deployment currently only works on OpenShift. Three issues prevent it from running on standard Kubernetes (e.g., KIND on ARM Mac):

  1. Container images are amd64-only — Dockerfile hardcodes --platform=linux/amd64, docker-compose.yml forces platform: linux/amd64. KIND on M-series Mac runs arm64 nodes.
  2. PostgreSQL image requires Red Hat authregistry.redhat.io/rhel9/postgresql-16:latest returns 401 on clusters without a Red Hat pull secret.
  3. OpenShift Routes don't exist on standard K8sroute.openshift.io/v1 CRD is not available.

Proposed Changes

1. Multi-arch container builds

Dockerfile (line 2): Remove --platform=linux/amd64 from FROM line.

docker-compose.yml (lines 46, 90): Remove platform: linux/amd64 from backend and ui services. Local docker compose build will now build for the native platform.

Makefile: Add variables and a docker-buildx target for multi-arch registry pushes:

  • New variables: BACKEND_IMAGE, UI_IMAGE, IMAGE_TAG, PLATFORMS (default linux/amd64,linux/arm64)
  • New target docker-buildx: Uses docker buildx build --platform $(PLATFORMS) --push for both backend and UI images. Creates a buildx builder lazily if one doesn't exist.
  • Keep existing docker-build (local native-arch via docker-compose) and docker-push (single-arch tag+push) unchanged.
  • PLATFORMS is overridable to add more architectures in the future (e.g., make docker-buildx PLATFORMS=linux/amd64,linux/arm64,linux/s390x).

2. Platform-specific PostgreSQL manifests

Replace deploy/kubernetes/postgres.yaml with two variants:

deploy/kubernetes/postgres-openshift.yaml — Current file renamed. Red Hat image (registry.redhat.io/rhel9/postgresql-16:latest), POSTGRESQL_* env vars, mount at /var/lib/pgsql/data.

deploy/kubernetes/postgres-kubernetes.yaml — New file. Official image (postgres:16, multi-arch, public), POSTGRES_* env vars, mount at /var/lib/postgresql/data. Same PVC, Service, probes, and resource limits.

Delete deploy/kubernetes/postgres.yaml after creating both variants.

3. Rewrite deploy-all.sh with target argument

deploy/kubernetes/deploy-all.sh — Rewrite to accept openshift or kubernetes as a required positional argument:

  • openshift: Uses oc, applies postgres-openshift.yaml and route.yaml
  • kubernetes: Uses kubectl, applies postgres-kubernetes.yaml, skips routes, prints kubectl port-forward instructions for accessing UI and backend

Shared manifests applied for both targets: namespace, secrets, ollama, backend, ui, db-init-job.

Script resolves paths relative to its own location (not cwd) so it works from anywhere.

4. Files NOT changed

File Reason
route.yaml Already isolated; only applied for OpenShift
backend.yaml MODEL_CATALOG_URL is inert when service doesn't exist
ollama.yaml ollama/ollama:latest is already multi-arch
ui/Dockerfile Already has no platform constraint
All other shared manifests Platform-independent

File Summary

File Action
Dockerfile Edit: remove --platform=linux/amd64
docker-compose.yml Edit: remove two platform: linux/amd64 lines
Makefile Edit: add variables + docker-buildx target
deploy/kubernetes/postgres.yaml Delete (replaced by two variants)
deploy/kubernetes/postgres-openshift.yaml Create (copy of current postgres.yaml)
deploy/kubernetes/postgres-kubernetes.yaml Create (official postgres:16 image)
deploy/kubernetes/deploy-all.sh Rewrite with target argument

Verification

  1. Local docker-compose on ARM Mac: docker compose build should build arm64 images natively
  2. KIND deployment on ARM Mac: ./deploy-all.sh kubernetes — all pods should reach Ready
  3. Multi-arch push: make docker-buildx should build+push amd64 and arm64 manifests to quay.io
  4. OpenShift deployment: ./deploy-all.sh openshift should work as before (uses oc, Red Hat postgres, Routes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions