Managing Batch on GKE users

Using Google Cloud Filestore for storage

Prerequisites

You must have already installed Batch on GKE.

  1. Get the admin tools:

    git clone https://github.com/GoogleCloudPlatform/Kbatch.git
    
  2. 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]
  1. Replace values of [FILESTORE_FILESHARE_NAME] and [FILESTORE_SERVER_IP] with your filestore instance's values.

  2. 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.

  1. Change to the filestore directory:

    cd filestore
    
  2. Run deploy_nfs_client_provisioner.sh:

    ./deploy_nfs_client_provisioner.sh [gke_region] [gke_cluster_name] [filestore_zone] [filestore_instance_name] [filestore_fileshare]
    
  3. 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

What's next

Was this page helpful? Let us know how we did:

Send feedback about...

Kubernetes Engine Documentation