This default setting is only for a Longhorn system that hasn’t been deployed. It has no impact on an existing Longhorn system. The settings for any existing Longhorn system should be modified using the Longhorn UI.

The default settings can be customized in the following ways:

From the project view in Rancher, go to Apps > Launch > Longhorn and edit the settings before launching the app.

  1. Download the longhorn repo:

  2. Modify the config map named longhorn-default-setting in the yaml file longhorn/deploy/longhorn.yaml. For example:

    1. ---
    2. apiVersion: v1
    3. kind: ConfigMap
    4. metadata:
    5. name: longhorn-default-setting
    6. namespace: longhorn-system
    7. data:
    8. default-setting.yaml: |-
    9. backup-target:
    10. backup-target-credential-secret:
    11. allow-recurring-job-while-volume-detached:
    12. create-default-disk-labeled-nodes:
    13. default-data-path:
    14. replica-soft-anti-affinity:
    15. storage-over-provisioning-percentage:
    16. storage-minimal-available-percentage:
    17. upgrade-checker:
    18. default-replica-count:
    19. default-data-locality:
    20. guaranteed-engine-cpu:
    21. default-longhorn-static-storage-class:
    22. backupstore-poll-interval:
    23. system-managed-components-node-selector:
    24. priority-class:
    25. auto-delete-pod-when-volume-detached-unexpectedly:
    26. disable-scheduling-on-cordoned-node:
    27. replica-zone-soft-anti-affinity:
    28. volume-attachment-recovery-policy:
    29. node-down-pod-deletion-policy:
    30. allow-node-drain-with-last-healthy-replica:
    31. mkfs-ext4-parameters:
    32. disable-replica-rebuild:
    33. replica-replenishment-wait-interval:
    34. disable-revision-counter:
    35. system-managed-pods-image-pull-policy:
    36. allow-volume-creation-with-degraded-availability:
    37. auto-cleanup-system-generated-snapshot:
    38. concurrent-automatic-engine-upgrade-per-node-limit:
    39. backing-image-cleanup-wait-interval:
    40. guaranteed-engine-manager-cpu:
    41. guaranteed-replica-manager-cpu:
    42. ---
  • Helm 2

  • Helm 3

    1. helm install longhorn longhorn/longhorn \
    2. --namespace longhorn-system \
    3. --create-namespace \
    4. --set defaultSettings.taintToleration="key1=value1:NoSchedule; key2:NoExecute"

You can also provide a copy of the values.yaml file with the default settings modified to the --values flag when running the Helm command:

  1. Obtain a copy of the values.yaml file from GitHub:

  2. Modify the default settings in the YAML file. The following is an example snippet of values.yaml:

    1. defaultSettings:
    2. backupTargetCredentialSecret: minio-secret
    3. createDefaultDiskLabeledNodes: true
    4. defaultDataPath: /var/lib/longhorn-example/
    5. replicaSoftAntiAffinity: false
    6. storageOverProvisioningPercentage: 600
    7. storageMinimalAvailablePercentage: 15
    8. upgradeChecker: false
    9. defaultReplicaCount: 2
    10. defaultDataLocality: disabled
    11. guaranteedEngineCPU:
    12. defaultLonghornStaticStorageClass: longhorn-static-example
    13. backupstorePollInterval: 500
    14. taintToleration: key1=value1:NoSchedule; key2:NoExecute
    15. systemManagedComponentsNodeSelector: "label-key1:label-value1"
    16. priority-class: high-priority
    17. autoSalvage: false
    18. disableSchedulingOnCordonedNode: false
    19. replicaZoneSoftAntiAffinity: false
    20. volumeAttachmentRecoveryPolicy: never
    21. nodeDownPodDeletionPolicy: do-nothing
    22. mkfsExt4Parameters: -O ^64bit,^metadata_csum
    23. guaranteed-engine-manager-cpu: 15
    24. guaranteed-replica-manager-cpu: 15
    • Helm 2

    • Helm 3

      1. helm install longhorn longhorn/longhorn \
      2. --namespace longhorn-system \
      3. --create-namespace \
      4. --values values.yaml

For more info about using helm, see the section about

Original feature request

Available since v0.6.0