Using Google Cloud Filestore for storage
Prerequisites
You must have already installed Batch on GKE.
Get the admin tools:
git clone https://github.com/GoogleCloudPlatform/Kbatch.git
Go to the admin tools directory:
cd admintools
Set up Filestore as a storage option for users
Create a Google Filestore instance in the same zone that is your GKE cluster's node location for inputs / outputs.
Create a PersistentVolume
The following persistentvolume.yaml describes a PersistentVolume hosted on Filestore.
apiVersion: v1 kind: PersistentVolume metadata: name: pv spec: storageClassName: nfs capacity: storage: 1T accessModes: - ReadWriteMany nfs: path: [/FILESTORE_FILESHARE_NAME] server: [FILESTORE_SERVER_IP]
Replace values of [FILESTORE_FILESHARE_NAME] and [FILESTORE_SERVER_IP] with your filestore instance's values.
Create a PersistentVolume for Filestore from the YAML file.
kubectl create -f persistentvolume.yaml
Create a PersistentVolumeClaim
The following persistentvolumeclaim.yaml describes a PersistentVolumeClaim.
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc namespace: default spec: accessModes: - ReadWriteMany storageClassName: nfs resources: requests: storage: 1T
Create a PersistentVolumeClaim for Filestore from the YAML file.
kubectl create -f persistentvolumeclaim.yaml
Creating private directories
Private directories grant a user sole permission to read / write to a directory.
Install NFS auto provisioners to create private directories for users on your Filestore instance.
Change to the filestore directory:
cd filestore
Run deploy_nfs_client_provisioner.sh:
./deploy_nfs_client_provisioner.sh [gke_region] [gke_cluster_name] [filestore_zone] [filestore_instance_name] [filestore_fileshare]
Add users and set their UID and GID to match the directory permissions set on your Filestore instance. For more information go to Adding a new Batch on GKE user with a private PersistentVolumeClaim