As a new backend developer, I'm curious about the storage options for databases in real-world production environments. I typically run my development setup using Docker Compose, but I want to understand how this translates to production systems. Specifically, how do companies store their databases, like PostgreSQL, Elasticsearch, Redis, Kafka, and RabbitMQ?
I believe Kubernetes is mainly used for stateless applications, such as API and web servers, which can handle being restarted without data loss. So, where do data stores typically reside? Are they managed services on cloud providers like AWS, running in their own VMs, or can they be housed within Kubernetes clusters using StatefulSets and PersistentVolumeClaims for data persistence? I'm still learning about these concepts, so I'd appreciate any insights!
5 Answers
There's ongoing debate about whether to run databases on Kubernetes. I've been using them (like PostgreSQL and Kafka) within a Kubernetes cluster and find it manageable. Sure, if you want the very best performance, you might consider external hosting, but for many, Kubernetes is a cost-effective and easy way to manage these services.
Running databases inside Kubernetes or opting for managed services often varies based on your needs and expertise. If you're confident in Kubernetes management, go for it; otherwise, using something like AWS's managed services can save you a lot of headaches.
I've had experience running stateful applications like databases in Kubernetes. It works well with Operators, which simplify things, but it's essential to understand the underlying architecture as well. At the end of the day, it's all managed by a kernel, and how you orchestrate it is up to you.
In my transition to Kubernetes, we've been using StatefulSets and PersistentVolumeClaims for our databases. These tools help maintain data across pod restarts. If there's an operator available for the software you're using, I recommend leveraging it to benefit from the hard work someone else has already put in.
Ultimately, it comes down to your tech stack and business decisions. Kubernetes is versatile and can handle a range of applications, including databases. Just remember, your choices should align with your budget and operational capabilities.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically