Does It Make Sense To Run Database On Kubernetes?

Dec 20, 2021 2 minutes read
SHVETS production (pexels.com)

As containerization continues to revolutionize the way we develop, deploy, and manage applications, Kubernetes has emerged as the go-to solution for container orchestration. It has become the de facto standard for managing containerized applications and services at scale. However, one question that arises is whether it makes sense to run databases on Kubernetes.

Does it make sense?

The short answer is no. It is possible to run databases on Kubernetes and but it's not always the best option. Kubernetes provides numerous benefits, such as automated deployment, scaling, and management of containerized applications, but these benefits are not related to databases things. When considering this, I am referring to production systems that also need to account for data retention policies and ensure a state guarantee.

Why it does not?

One of the primary concerns with running databases on Kubernetes is data persistence. Data is critical to any application, and it needs to be stored in a reliable and secure way. Kubernetes is designed for stateless applications, which means it's not optimized for handling stateful applications like databases.

Of course there are all sorts of storage types and volumes, but those are not always designed to be used as a database storage. K8s and dbs use different architectural designs and cater to distinct use cases. K8s requires a different approach for managing data storage, especially when dealing with stateful applications like databases.

And databases are typically resource-intensive and require specific configurations to perform optimally. Kubernetes can provide dynamic scaling and resource allocation, but it's not always straightforward to achieve the right balance between performance and resources. Moreover, Kubernetes does not provide any database-specific features, such as replication, backups, or monitoring. These features need to be implemented externally, which can add complexity and additional overhead.

Summary

Overall, it makes sense to run databases on Kubernetes if you have a clear understanding of the benefits and limitations of the platform or you want to play with dbs locally or non production systems. For any other case (prod) you need to carefully consider factors like data persistence, performance, and manageability to ensure that you're getting the most out of your database deployment.

In conclusion, running databases on Kubernetes is a viable option, but it requires careful planning and implementation. Kubernetes can provide several benefits, but it's not always the best choice for every use case. You should weigh the benefits and limitations of Kubernetes against your specific database requirements to determine whether it's the right platform for you.

Benjamin Good wrote an interesting article on the Google blog, he also provided a nice decision tree that will may help you - To run or not to run a database on Kubernetes: What to consider.

Disclaimer: The opinions expressed here are my own and do not necessarily represent those of current or past employers.
Comments (0)