How do i mount an existing GCP Filestore to a new or an existing HPC cluster?

12 views
Skip to first unread message

smahane douyeb

unread,
Mar 4, 2020, 7:23:40 PM3/4/20
to elasticluster
Hello,

I have a Filestore storage on GCP that has data. I need to mount it to an existing cluster and to a new cluster that i will be creating. 
How do i add it to ~./elasticluster/config? and how can i update the existing cluster to mount it to all the nodes?

It's in this format : <IP Address>:/filestorename


Thank you,

Riccardo Murri

unread,
Mar 6, 2020, 4:06:57 AM3/6/20
to smahane douyeb, elasticluster
Hello Smahane,

as far as I understand from reading the docs (never used GCP's
"Filestore" myself, yet), the filestore is made available to VMs like
a normal NFS filesystem.

So you have several options to mount it; for example to mount it on
directory `/data` on a running cluster:

pdsh -a sudo mkdir -p /data
pdsh -a sudo mount -t nfs 1.2.3.4:/filestorename /data

This only works "temporarily" in that the mount point disappears at
reboot; you need to edit `/etc/fstab` for it to be permanent.

To have a more permanent solution that can be re-used across clusters,
it's better to write a small Ansible playbook; like the following
(enclosed in "```" markers).

```
- name: Mount volume on head node
tags:
- after
- local
hosts: all

vars:
# mount point for the filesystem
mountpoint: '/data'
# IP address of filestore endpoint
filestore_server: 1.2.3.4
# filestore endpoint name
filestore_name: foobar

tasks:

- name: Ensure mountpoint directory exists
file:
dest: '{{ mountpoint }}'
state: directory

- name: Mount filesystem
mount:
path: '{{ mountpoint }}'
src: '{{ filestore_server }}:/{{ filestore_name }}'
fstype: nfs
state: mounted
```

You can then run this playbook on all cluster nodes via:

elasticluster setup my-cluster-name -- /path/to/playbook/file.yml

Hope this helps!

Riccardo

smahane douyeb

unread,
Mar 6, 2020, 2:01:07 PM3/6/20
to elasticluster
Thanks a lot. I will give it  a try!
Reply all
Reply to author
Forward
0 new messages