How do you run MySQL workloads in k8s


I am looking for examples of how people here are running MySQL (or any other DB) workloads in k8s. In particular:

  • Do you run it in master/save configuration (StatefulSets) inside k8s?
  • Do you prefer running it outside of k8s, such as on standalone machines, or via managed services such as RDS?
  • What sort of storage do you use for it in order to ensure redundancy and high availability? Do you use distributed storage? If so, which one?
  • When running inside k8s, do you notice a performance hit as compared to running it independently?



I would highly recommend using a managed service like RDS or Google Cloud SQL. I feel that the days of the dedicated DBA have passed. With todays managed services you can focus on your application and infrastructure.

With that being said, running database workloads on Kubernetes is perfectly fine and in most cases acceptable.

What is really boils down to is the StorageClass's available to you. In most default installs your only (at least at first) option is to use a hostPath in your PersistentVolume's. This is really an anti-pattern of high-availability in the event your node goes down.

When I deploy MySQL on-prem I use a glusterfs backed volume and hit the ground running. The rest is just a matter of configuration.

Hope this helps give you some insight.