Setup Local Persistent Volume on physical machines with Kubernetes Setup Local Persistent Volume on physical machines with Kubernetes kubernetes kubernetes

Setup Local Persistent Volume on physical machines with Kubernetes


  1. You can deploy the database as statefulset using local volumes on nodes.Just create the volumes and put them in a StorageClass

  2. For backup , you need to setup the replication on the database level ( not volume level ) to some other cluster /other database instance running somewhere else/or on some other cluster.

  3. Pod failures are handled by kubernetes anyway , it will restart the pod if goes unhelathy.

  4. Node failures can't be handled in statefulset ( one node can't replace another , in other words , in statefulset a pod will not be restarted on other node , kubernetes will wait for node to come back )

  5. If you are going for simple single pod deployement rather than statefulset , you can deploy the database as single pod and another instance as single pod and use node selector to run those on different nodes , then setup the replication from one instance to another instance on database level , and configure your client app to failover to fallback instance in case the primary is not available , this needs to be synchronous replication.

Links:

Run a Single-Instance Stateful Application ( MYSQL)

Run a Replicated Stateful Application ( MYSQL )