简体   繁体   中英

Kubernetes - Persistent storage for PostgreSQL

We currently have a 2-node Kubernetes environment running on bare-metal machines (no GCE) and now we wish to set up a PostgreSQL instance on top of this.

Our plan was to map a data volume for the PostgreSQL Data Directory to the node using the volumeMounts option in Kubernetes. However this would be a problem because if the Pod ever gets stopped, Kubernetes will re-launch it at random on one of the other nodes. Thus we have no guarantee that it will use the correct data directory on re-launch...

So what is the best approach for maintaining a consistent and persistent PostgreSQL Data Directory across a Kubernetes cluster?

  • one solution is to deploy HA postgresql, for example https://github.com/sorintlab/stolon

  • another is to have some network storage attached to all nodes(NFS, glusterFS) and use volumeMounts in the pods

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM