Accessing a shared directory inside GKE from an external world

10/13/2020

I am newbie to Google Cloud and GKE and i am trying to setup NFS Persistent Volumes with Kubernetes on GKE with the help of following link : https://medium.com/platformer-blog/nfs-persistent-volumes-with-kubernetes-a-case-study-ce1ed6e2c266

I had followed the instructions and i was able to achieve the desired results as mentioned in the blog but i need to access the shared folder (/uploads) from an external world so can someone help me to achieve it or any pointers or any suggestions to achieve the same

-- Vikram
file-sharing
google-kubernetes-engine
kubernetes
nfs

2 Answers

11/4/2020

I have followed the doc and implemented the steps on my test GKE cluster like you. Just I have one observation about the current API version for deployment. We need to use apiVersion: apps/v1 instead of apiVersion: extensions/v1beta1. Then I test with a busybox pod to mount the volume and the test was successful.

BusyBox POD

Then I exposed the service “nfs-server” as service type “Load Balancer” like below

Expose nfs-server

and found the external load balancer endpoints like (LB_Public_Ip):111 in Services & Ingress tab. I allowed ports 111, 2049, 20048 in firewall. After that I took a redhat based VM in the GCP project and installed “sudo dnf install nfs-utils -y”. Then you may use the below command to see the nfs exports list. Then you can mount it as expected.

-sudo showmount -e LB_Public_IP

-- Nazmul Haque
Source: StackOverflow

10/28/2020

Please have a look on the below sample configuration and you may follow the GCP doc

Sample Config

-- Nazmul Haque
Source: StackOverflow