You may customize Longhorn’s default settings while installing or upgrading. You may specify, for example, and Default Data Path before starting Longhorn.

The default settings can be customized in the following ways:

From the project view in Rancher, go to Apps && Marketplace > Longhorn > Install > Next > Edit Options > Longhorn Default Settings > Customize Default Settings and edit the settings before installing the app.

Using the Longhorn Deployment YAML File

  1. Download the longhorn repo:

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

    In the below example, users customize the default settings, backup-target, backup-target-credential-secret, and default-data-path. When the setting is absent or has a leading # symbol, the default setting will use the default value in Longhorn or the customized values previously configured.

    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: s3://backupbucket@us-east-1/backupstore
    10. backup-target-credential-secret: minio-secret
    11. #create-default-disk-labeled-nodes:
    12. default-data-path: /var/lib/longhorn-example/
    13. #replica-soft-anti-affinity:
    14. #replica-auto-balance:
    15. #storage-over-provisioning-percentage:
    16. #storage-minimal-available-percentage:
    17. #upgrade-checker:
    18. #default-replica-count:
    19. #default-data-locality:
    20. #default-longhorn-static-storage-class:
    21. #backupstore-poll-interval:
    22. #taint-toleration:
    23. #system-managed-components-node-selector:
    24. #priority-class:
    25. #auto-salvage:
    26. #auto-delete-pod-when-volume-detached-unexpectedly:
    27. #disable-scheduling-on-cordoned-node:
    28. #replica-zone-soft-anti-affinity:
    29. #allow-node-drain-with-last-healthy-replica:
    30. #mkfs-ext4-parameters:
    31. #disable-replica-rebuild:
    32. #replica-replenishment-wait-interval:
    33. #concurrent-replica-rebuild-per-node-limit:
    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. #backing-image-recovery-wait-interval:
    41. #guaranteed-engine-manager-cpu:
    42. #guaranteed-replica-manager-cpu:
    43. #kubernetes-cluster-autoscaler-enabled:
    44. #orphan-auto-deletion:
    45. #storage-network:
    46. #recurring-successful-jobs-history-limit:
    47. #recurring-failed-jobs-history-limit:
    48. ---

Using Helm

Use the Helm command with the --set flag to modify the default settings. For example:

  • Helm 3

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:

    1. curl -Lo values.yaml https://raw.githubusercontent.com/longhorn/charts/master/charts/longhorn/values.yaml
  2. Modify the default settings in the YAML file. The following is an example snippet of values.yaml:

    When the setting is absent or has a leading # symbol, the default setting will use the default value in Longhorn or the customized values previously configured.

    1. defaultSettings:
    2. backupTarget: s3://backupbucket@us-east-1/backupstore
    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. defaultLonghornStaticStorageClass: longhorn-static-example
    12. backupstorePollInterval: 500
    13. taintToleration: key1=value1:NoSchedule; key2:NoExecute
    14. systemManagedComponentsNodeSelector: "label-key1:label-value1"
    15. priorityClass: high-priority
    16. autoSalvage: false
    17. disableSchedulingOnCordonedNode: false
    18. replicaZoneSoftAntiAffinity: false
    19. volumeAttachmentRecoveryPolicy: never
    20. nodeDownPodDeletionPolicy: do-nothing
    21. mkfsExt4Parameters: -O ^64bit,^metadata_csum
    22. guaranteedEngineManagerCpu: 15
    23. guaranteedReplicaManagerCpu: 15
    24. orphanAutoDeletion: false
  3. Run Helm with values.yaml:

  • Helm 2

  • Helm 3

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

We recommend using the Longhorn UI to change Longhorn setting on the existing cluster. It would make the setting persistent.

Using the Rancher UI

From the project view in Rancher, go to Apps && Marketplace > Longhorn > Upgrade > Next > Edit Options > Longhorn Default Settings > Customize Default Settings and edit the settings before upgrading the app to the current Longhorn version.

Using Kubectl

If you prefer to use the command line to update the setting, you could use kubectl.

  1. kubectl edit settings <SETTING-NAME> -n longhorn-system

Modify the default settings in the YAML file as described in Fresh Installation > Using Helm and then update the settings using

Using the Rancher UI

From the project view in Rancher, go to Apps && Marketplace > Longhorn > Upgrade > Next > Edit Options > Longhorn Default Settings > Customize Default Settings and edit the settings before upgrading the app.

Using the Longhorn Deployment YAML File

Modify the config map named longhorn-default-setting in the yaml file longhorn/deploy/longhorn.yaml as described in Fresh Installation > Using the Longhorn Deployment YAML File and then upgrade the Longhorn system using kubectl.

Modify the default settings in the YAML file as described in Fresh Installation > Using Helm and then upgrade the Longhorn system using helm upgrade.

Available since v1.3.0 (Reference)