GCE volume mounts as compared to Kubernetes volume mounts

4/2/2019

Kubernetes has pretty extensive volume and volume mounting support (many different volume types, subpaths, mounting single files).

Can the same be achieved with GCE VMs?

Update: I have some Kubernetes workflow that uses NFS and GCE PD volumes. Suppose I want to run the same workflow without Kubernetes (by just starting GCE VMs). What volume-related features will I lose/keep?

Some examples of features:

  • Having the same volume shared between multiple producer Pods/VMs.
  • Mounting single files into container/VM (as opposed to mounting directories only).
-- Ark-kun
google-compute-engine
kubernetes
persistent-volumes
volumes

1 Answer

4/15/2019

The PVs and GCE PD volumes used by GKE use Google Persistent Disks and thus are bound by the same limitations. This also means that there isn't much you can do on k8s that you can't do on GCE. The major difference is the resources won't be as fluid.

You can attach a disk to a GCE VM and mount it as a subpath if you want at the OS level or just mount the entire disk normally. You can also use a single disk in readOnlyMany mode which can be shared by multiple VMs in the same zone (same restriction you have in GKE). If you need scalability, you can use a Managed Instance Group that uses a snapshot of your disk so that replication won't skew the data.

You can also mount NFS in GCE as in GKE. Migrating from GKE to GCE generally does not have too many restrictions. The major difference is that you are moving from a managed orchestration system to an unmanaged VM so you may need to do some more leg work to make sure that there is scalability (if need be) and resiliency.

Aside from the benefits that k8s offers all around, I can't think of any major benefits you lose concerning the volumes specifically.

-- Patrick W
Source: StackOverflow