Storage

A Project namespace can create PersistentVolume through PersistentVolumeClaim. PersistentVolume is always isolated within a Kubernetes Cluster.

storage.staroid.com annotation further isolate which Project namespace can access the volume in case of the storageClassName is nfs.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-pvc # Volume identifier. Different name creates different volume.
  annotations:
    storage.staroid.com/scope: Instance # Instance (default), Project or ProjectUser. Effective only when storageClassName is 'nfs'
spec:
  storageClassName: nfs # nfs (default), hdd or ssd.
  accessModes:
    - ReadWriteMany # Only nfs supports 'ReadWriteMany'.
  volumeMode: Filesystem
  resources:
    requests:
      storage: 1Gi

storage.staroid.com/scope annotation

Instance, Project or ProjectUser. Defualt Instance. Effective only when storageClassName is ‘nfs’.

Instance

Each PVC is unique per Project namespace.

Project

Project namespace of the same project in the same Kubernetes cluster can access the PersistentVolume.

ProjectUser

Project namespace of the same project launched by the same user in the same Kubernetes cluster can access the PersistentVolume.

A PersistentVolume can not be accessed from

storageClassName

nfs, hdd or ssd. Default nfs.

storageClassName

Supported Pod isolation (pod.staroid.com/isolation)

nfs

sandboxed, dedicated

hdd

dedicated

ssd

dedicated

Note

‘nfs’ storageClassName is a network-based file system. It is not optimized for High i/o, high throughput usage, such as large scale data processing.

Warning

‘hdd’ and ‘ssd’ storageClassName are only accessible from Pods which pod.staroid.com/isolation label is dedicated. see Pod metadata.labels.

accessModes

One of ReadWriteOnce, ReadOnlyMany, ReadWriteMany depends on the storageClassName.

storageClassName

Supported accessModes

nfs

ReadWriteOnce, ReadOnlyMany, ReadWriteMany

hdd

ReadWriteOnce

ssd

ReadWriteOnce

volumeMode

Only Filesystem is supported.

PersistentVolumeClaim Examples

nfs
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-nfs
  annotations:
    storage.staroid.com/scope: Instance
spec:
  storageClassName: nfs
  accessModes:
    - ReadWriteMany
  volumeMode: Filesystem
  resources:
    requests:
      storage: 1Gi
hdd
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-hdd
spec:
  storageClassName: hdd
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
ssd
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-ssd
spec:
  storageClassName: ssd
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi