News for hackers. Stuff that matters.
Re:Stateful Apps on Kubernetes: A quick primer by loiselleatwork on Tuesday May 01, 2018 @09:09PM (#16973272)
Author of post here and CRL employee: just for some additional detail, we reached out to Kelsey about the problems he's seen running databases in Kubernetes.

https://twitter.com/kelseyhightower/status/96347131657256140...

He said "You still need to worry about database backups and restores. You need to consider downtime during cluster upgrades."

These things are totally true. K8s doesn't automate backups (edit: by default; though, it can) and if you need to take K8s down for upgrades, then everything is down. For its part, though, CockroachDB supports rolling upgrades with no downtime on Kubernetes.

As for routing, that is tough problem if you want to run K8s across multiple regions, though we have some folks who've done it.

And if one finds setting up StatefulSets challenging, we have a tutorial on how to do it written by a former Kubernetes engineer: https://www.cockroachlabs.com/docs/stable/orchestrate-cockro...

Re:Stateful Apps on Kubernetes: A quick primer by hardwaresofton on Tuesday May 01, 2018 @09:58PM (#16973482)
Note that none of those things are impossible on kubernetes, k8s just doesn't offer them by default (which is good IMO).

There are projects that help you run databases in kubernetes and also make backups of many things hosted:

- Automatic CephFS for your cluster -> https://rook.io/docs/rook/master/

- Backups for cluster resources and volumes -> https://github.com/heptio/ark

- Spin up dynamic postgres clusters -> https://github.com/zalando-incubator/postgres-operator

Databases are just applications with different resource needs. Please stop pushing forward the notion that they can't be run in containers or container orchestration systems. Databases are just programs. If the substrate for running your containers doensn't reliably support flock or fsync or something your database needs, then maybe pick a better substrate that does -- container runtimes these days and kubernetes don't stand in your way these days.

Re:Stateful Apps on Kubernetes: A quick primer by merb on Wednesday May 02, 2018 @05:38AM (#16975354)
Well with k8s 1.10+ it's also possible to use statefulsets and local volume, so with affinity it's possible to just use k8s as an orchestration system where you "install" your database and keep it up to date with k8s. of course if a node goes down you need to failover, etc. but patroni/zalando postgres works really well with statefulsets and local volume. (as long as a single node is still running, which should always be the case...) (https://kubernetes.io/blog/2018/04/13/local-persistent-volum...)
Re:Stateful Apps on Kubernetes: A quick primer by hardwaresofton on Wednesday May 02, 2018 @11:55AM (#16978202)
I want to note that this has actually been possible since like k8s 1.7, you can just start a DB with node affinity and use hostPath volumes.

That's what I was doing until rook came around. If you're running in something like AWS (or even if you're not), you can also do something like attach an EBS volume (to a local host) and do that. Or, you can set up a plain ISCSI drive (or get one from your provider, even basic providers these days might offer storage that way) and use that.

There have been a LOT of choices for a long time.

Re:Stateful Apps on Kubernetes: A quick primer by merb on Wednesday May 02, 2018 @12:43PM (#16978785)
> even basic providers these days might offer storage that way

my "bare metal" provider doesn't ;)