Run postgresql in DigitalOcean Kubernetes with persistent volume claim
- Digitalocean kubernetes cluster since we run this configuration on DigitalOcean environment, GCP and other resource will come in next repository
- Make sure your kubectl already installed
- Download the kubernetes_config.yaml from DigitalOcean this config file rotated every week
-
Make sure you have access to your clusters
kubectl --kubeconfig="path_to_your_kubeconfig.yaml" get nodes
It will list of all your kubernetes cluster's nodes
-
Setup Digitalocean PVC visit this documentation for more information CSI DigitalOcean
-
Create Kubernetes Persistent Volume
kubectl --kubeconfig="path_to_your_kubeconfig.yaml" create -f pvc.yaml
-
Check if your persisten volume claim success
kubectl --kubeconfig="path_to_your_kubeconfig.yaml" get pv
-
Create postgres deployment
kubectl --kubeconfig="path_to_your_kubeconfig.yaml" create -f postgres.yaml
This process may take few mintes
Check deployment status
kubectl --kubeconfig="path_to_your_kubeconfig.yaml" get deployments
Check your service status
kubectl --kubeconfig="path_to_your_kubeconfig.yaml" get service
-
Finished! Now you can access your postgres throug external ip address in Service and his port For example: 192.xxx.xx:5432 and use postgres credentials that we set up through configmap.yaml
-
Support by star this repository ;)