Skip to content

Storage

Storage classes

ClassAccess modeDescription
hcloud-volumesReadWriteOnceBlock storage, the cluster default, supports volume expansion
nfs-rwxReadWriteManyNFS, for when several pods need to write at the same time

hcloud-volumes is the default class: a PVC without storageClassName lands there.

The RWX class is named nfs-rwx

Not nfs. A PVC with storageClassName: nfs stays Pending.

yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: data
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: hcloud-volumes
  resources:
    requests:
      storage: 10Gi

Billing

On hcloud-volumes there is a billing minimum of 10 GiB per volume. Smaller PVCs still provision normally but are billed at 10 GiB, so five 2 GiB volumes cost the same as five 10 GiB ones. The floor comes from the block storage itself, not from us.

nfs-rwx has no minimum. It is billed at the size you request, so a 1 GiB shared volume is billed as 1 GiB.

For uploads, media and anything else that does not need a filesystem, object storage is usually cheaper than a volume and is not tied to a single namespace.

Autoresize

Volumes can grow automatically, controlled by three annotations on the PVC:

AnnotationMeaning
resize.topolvm.io/thresholdHow little free space triggers an expansion
resize.topolvm.io/increaseHow much to add per step
resize.topolvm.io/storage_limitUpper bound for expansion
yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: data
  annotations:
    resize.topolvm.io/threshold: "20%"
    resize.topolvm.io/increase: "10Gi"
    resize.topolvm.io/storage_limit: "100Gi"
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: hcloud-volumes
  resources:
    requests:
      storage: 10Gi

threshold is free space, not used space

"20%" means: expand once less than 20% is free, that is at 80% full. This is the opposite of what most people assume.

Set it to "80%" and the volume expands at 20% full. It then keeps growing step by step up to storage_limit without ever having been close to full, and you pay for that space the whole time.

Where it works

  • On hcloud-volumes. Autoresize does not work on nfs-rwx.
  • On CloudNativePG and MariaDB volumes as well.

Volumes only grow

A volume can be expanded but never shrunk. That applies to autoresize and to a manually raised resources.requests.storage alike. To get smaller, create a new PVC, copy the data, and delete the old one.

What's next