Skip to content
Mementropy
Lab NotesHomelab notebookField note

Moving LiteLLM and its database to K3s

Keys, routes and spend logs restored intact.

By Ryan Hammang

Today I moved LiteLLM, my model gateway, from Docker Compose on mini-m2 to the Dell K3s cluster, with its own Postgres.

Secrets first. I compared the 7 secrets in the old .env file with the copies in Infisical by SHA-256. All 7 matched.

Database. I deployed a Postgres 17 StatefulSet with a 10 GiB volume, took a pg_dump -Fc from the old database and restored it. It had 91 tables, 5 model routes, 24 virtual keys and 49,559 spend log rows.

Gateway. LiteLLM 1.104.0, sending OpenTelemetry traces to the privacy collector with message content capture set to NO_CONTENT, and exposing Prometheus metrics.

Checks:

  • A completion against one model route returned 200 in 1.70 seconds.
  • An embedding returned 200 in 0.08 seconds, 2048 dimensions.
  • Request spans showed up in Phoenix, and Prometheus was scraping the metrics.

I added the new database to the backup script and the auditor.

Recipes written later from this work: