A note on there's a server nobody dares restart
Containerising a legacy trading service on Kubernetes
Moving a stateful on-prem trading service onto Kubernetes is less about Docker and more about state, config and graceful failure. A pragmatic path that doesn't break trading.
Wrapping the binary in an image is a morning's work.
A lot of trading infrastructure is a long-running service that someone installed on a box years ago, configured by hand, and has been afraid to touch ever since. Putting it on Kubernetes is appealing — self-healing, horizontal scale, clean rollouts — but the hard part was never docker build. It’s everything the old box was quietly doing for you.
Containerising is the easy 20%
Wrapping the binary in an image is a morning’s work. The remaining four-fifths is teaching the service to live in an environment that can kill and reschedule it at any moment, on a node it has never seen, with none of the local state it used to rely on. That mindset shift — from “a process on a server” to “a replaceable pod” — is the whole project.
State is the first question
Before anything else, find the state. Legacy trading services love to keep things on local disk: cache files, working directories, lock files, logs they tail themselves. In Kubernetes the filesystem is ephemeral and the pod can move, so each piece of state needs a decision:
- Genuinely transient — let it live in the container and disappear on restart.
- Shared or durable — move it to a database, object storage, or a persistent volume.
- Coordination state (locks, “am I the primary?”) — this is the dangerous one. A service that assumed it was the only instance will misbehave the moment Kubernetes runs two replicas. Decide deliberately whether it’s a singleton (one replica, a leader-election lease) or can genuinely run in parallel.
Get this wrong and you get the classic failure: two pods both think they own the end-of-day run, and you reconcile the mess the next morning.
Config and secrets come out of the image
Hard-coded connection strings and config files baked into the box have to move to ConfigMaps and Secrets, injected at runtime. The image becomes identical across every environment; only the injected config differs. This is the same discipline that makes a good release pipeline work — build once, promote the same artefact, vary only the environment.
Teach it to report its own health
Kubernetes only manages a pod well if the pod tells the truth about itself:
- A readiness probe that returns healthy only when the service can actually do work — connected to its database and its message broker, not just “the process started.” Until then, no traffic.
- A liveness probe that catches the deadlocked-but-not-dead state, so a wedged pod gets restarted instead of silently dropping work.
- Graceful shutdown: handle the termination signal, stop accepting new work, finish what’s in flight, then exit. A trading service that drops a half-processed message on shutdown is worse than one that takes a few seconds longer to stop.
Scale honestly
Horizontal scaling is the headline feature, but only stateless or properly-coordinated work can use it. Be clear-eyed about which parts of the service are genuinely parallel and which must stay a singleton. Often the right answer is a single well-behaved replica with fast, automatic recovery — which is already a large upgrade over a hand-built box with a runbook.
The payoff
Done properly, a service that used to mean a maintenance window and a nervous engineer becomes a deployment that rolls out, self-checks, and rolls back on its own if the probes go red. The trading desk never notices, which is exactly the point. The goal was never “we use Kubernetes now” — it’s that the thing the desk depends on stopped being fragile.
Is this happening on your desk?This is the consulting work I do. Tell me what you're seeing and I'll say whether I can help.
Send a consulting enquiry