Storage Class Parameters
Storage Class as a resource object has a number of settable parameters. Here’s a sample YAML:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: longhorn-test
provisioner: driver.longhorn.io
allowVolumeExpansion: true
reclaimPolicy: Delete
volumeBindingMode: Immediate
parameters:
numberOfReplicas: "3"
staleReplicaTimeout: "2880"
fromBackup: ""
fsType: "ext4"
# mkfsParams: ""
# migratable: false
# encrypted: false
# dataLocality: "disabled"
# replicaAutoBalance: "ignored"
# diskSelector: "ssd,fast"
# nodeSelector: "storage,fast"
# recurringJobSelector: '[{"name":"snap-group", "isGroup":true},
# {"name":"backup", "isGroup":false}]'
# backingImageName: ""
# backingImageChecksum: ""
# backingImageDataSourceType: ""
# backingImageDataSourceParameters: ""
# unmapMarkSnapChainRemoved: "ignored"
# disableRevisionCounter: false
# replicaSoftAntiAffinity: "ignored"
# replicaZoneSoftAntiAffinity: "ignored"
# nfsOptions: "soft,timeo=150,retrans=3"
Some fields are common to all Kubernetes storage classes. See also Kubernetes Storage Class.
provisioner
)Specifies the plugin that will be used for dynamic creation of persistent volumes. For Longhorn, that is always “driver.longhorn.io”.
allowVolumeExpansion
)Default:
true
See Kubernetes Storage Class: Allow Volume Expansion.
reclaimPolicy
)Default:
Delete
See Kubernetes Storage Class: Reclaim Policy.
mountOptions
)Default
[]
See Kubernetes Storage Class: Mount Options.
volumeBindingMode
)Default
Immediate
See Kubernetes Storage Class: Volume Binding Mode.
Note that some of these parameters also exist and may be specified in global settings. When a volume is provisioned with Kubernetes against a particular StorageClass, StorageClass parameters override the global settings.
These fields will be applied for new volume creation only. If a StorageClass is modified, neither Longhorn nor Kubernetes is responsible for propagating changes to its parameters back to volumes previously created with it.
parameters.numberOfReplicas
)Default:
3
The desired number of copies (replicas) for redundancy.
Global setting: Default Replica Count.
parameters.staleReplicaTimeout
)Default:
30
Minutes after a replica is marked unhealthy before it is deemed useless for rebuilds and is just deleted.
parameters.fromBackup
)Default:
""
Example:"s3://backupbucket@us-east-1?volume=minio-vol01&backup=backup-eeb2782d5b2f42bb"
URL of a backup to be restored from.
parameters.fsType
)Default:
ext4
For more details, see Creating Longhorn Volumes with Kubernetes
parameters.mkfsParams
)Default:
""
For more details, see Creating Longhorn Volumes with Kubernetes
parameters.migratable
)Default:
false
Allows for a Longhorn volume to be live migrated from one node to another. Useful for volumes used by Harvester.
parameters.encrypted
)Default:
false
More details in Encrypted Volumes
parameters.dataLocality
)Default:
disabled
If enabled, try to keep the data on the same node as the workload for better performance.
Global setting: Default Data Locality
More details in Data Locality.
parameters.replicaAutoBalance
)Default:
ignored
If enabled, move replicas to more lightly-loaded nodes.
Global setting: Replica Auto Balance
More details in Auto Balance Replicas.
parameters.diskSelector
)Default:
""
Example:"ssd,fast"
A list of tags to select which disks are candidates for replica placement.
More details in Storage Tags
parameters.nodeSelector
)Default:
""
Example:"storage,fast"
A list of tags to select which nodes are candidates for replica placement.
More details in Storage Tags
parameters.recurringJobSelector
)Default:
""
Example:[{"name":"backup", "isGroup":true}]
A list of recurring jobs that are to be run on a volume.
More details in Recurring Snapshots and Backups
parameters.backingImageName
)Default:
""
See Backing Image
parameters.backingImageChecksum
)Default:
""
See Backing Image
parameters.backingImageDataSourceType
)Default:
""
See Backing Image
parameters.backingImageDataSourceParameters
)Default:
""
See Backing Image
parameters.unmapMarkSnapChainRemoved
)Default:
ignored
Global setting: Remove Snapshots During Filesystem Trim.
More details in Trim Filesystem.
parameters.disableRevisionCounter
)Default:
false
Global setting: Disable Revision Counter.
More details in Revision Counter.
parameters.replicaSoftAntiAffinity
)Default:
ignored
Global setting: Replica Node Level Soft Anti-Affinity.
More details in Scheduling and Best Practices.
parameters.replicaZoneSoftAntiAffinity
)Default:
ignored
Global setting: Replica Zone Level Soft Anti-Affinity.
More details in Scheduling.
parameters.nfsOptions
)Default:
""
Example:"hard,sync"
More details in RWX Workloads
If Longhorn is installed via Helm, values in the default storage class can be set by editing the corresponding item in values.yaml. All of the Storage Class parameters have a prefix of “persistence”. For example, persistence.defaultNodeSelector
.
© 2019-2024 Longhorn Authors | Documentation Distributed under CC-BY-4.0
© 2024 The Linux Foundation. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.