<p>In a scenario where there are multiple containers running multiple instances of a database, when data in one instance is changed, how that change is applied to other instances so the data consistency preserved? it should be taken into consideration that containers may have bee placed in different nodes, so they can't share a common volume.</p>

Mehdi Navran
<p>Deploying database to Kubernetes in high-availability mode is a quite complex task. </p>

<p>To save a lot of time, please consider using <a href="https://enterprisersproject.com/article/2019/2/kubernetes-operators-plain-english" rel="nofollow noreferrer">Kubernetes operators</a>. This way you can automate most of complex manual operations. Kubernetes operators allow you to describe desired configuration of an application (or database) in declarative way.  </p>

<p>Kubernetes operator in general is a set of additional objects (pods, services, configmaps, secrets, RBAC, custom resources definitions, PV, PVC, ...) responsible to create and maintain complex application lifecycle. </p>

<p>Usually Kubernetes operators related to database applications take care about deploying database cluster of the desired size to Kubernetes and creating all required resources. Also they keep desired number of replicas, implement backup/restore procedures, configure data replication, forward client traffic to a healthy database pod and more. </p>

<p>Most of well-known databases have ready-to-use operators already. You can find some resources below:</p>

<p>Mysql Resources: </p>

<ul>
<li><a href="https://blogs.oracle.com/developers/introducing-the-oracle-mysql-operator-for-kubernetes" rel="nofollow noreferrer">Introducing the Oracle MySQL Operator for Kubernetes</a></li>
<li><a href="https://github.com/oracle/mysql-operator" rel="nofollow noreferrer">Oracle MySQL Operator on GitHub</a></li>
<li><a href="https://medium.com/oracledevs/getting-started-with-the-mysql-operator-for-kubernetes-8df48591f592" rel="nofollow noreferrer">Getting started with the MySQL Operator for Kubernetes</a></li>
</ul>

<p>Percona Resources:</p>

<ul>
<li><a href="https://www.percona.com/doc/kubernetes-operator-for-pxc/index.html" rel="nofollow noreferrer">Percona Kubernetes Operator for Percona XtraDB Cluster</a></li>
<li><a href="https://www.presslabs.com/docs/mysql-operator/" rel="nofollow noreferrer">MySQL Operator</a></li>
<li><a href="https://github.com/presslabs/mysql-operator" rel="nofollow noreferrer">MySQL Operator on Github</a></li>
</ul>

<p>PostgreSQL resources:</p>

<ul>
<li><a href="https://github.com/CrunchyData/postgres-operator" rel="nofollow noreferrer">Crunchy Data PostgreSQL Operator</a></li>
<li><a href="https://github.com/zalando/postgres-operator" rel="nofollow noreferrer">Postgres Operator</a></li>
</ul>

<p>MongoDB resources:</p>

<ul>
<li><a href="https://docs.mongodb.com/kubernetes-operator/master/tutorial/install-k8s-operator/#install-the-k8s-op-full" rel="nofollow noreferrer">Install the MongoDB Enterprise Kubernetes Operator</a></li>
</ul>

<p>In case you are planning to use different type of database, please check for available operator from DB vendor searching "<em>DBname kubernetes operator</em>"</p>
