Kubernetes Postgresql Replicas with nfs

NFS

APT를 이용해 NFS 서버 설치

sudo apt-get install nfs-common nfs-kernel-server rpcbind portmap
sudo systemctl enable nfs-kernel-server
sudo systemctl start nfs-kernel-server

공유할 폴더 생성

sudo mkdir -p /mnt/postgres

sudo mkdir -p /mnt/postgres_standby

권한설정

sudo chown www-data:www-data /mnt/postgres
sudo chown www-data:www-data /mnt/postgres_standby

외부로 연결할 디렉터리와 ip 매칭하는 설정코드 추가
Kubernetes pod의 대역대로 192.168.79.0으로 설정하였다.

/mnt/postgres 192.168.79.0/24(rw,sync,no_subtree_check,no_root_squash)
/mnt/postgres_standby 192.168.79.0/24(rw,sync,no_subtree_check,no_root_squash)

지금까지의 설정 적용하기

sudo exportfs -r

Leave a Comment