You may customize Longhorn’s default settings when deploying it. You may specify, for example, Create Default Disk With Node Labeled and Default Data Path before starting Longhorn.

Usage

This default setting is only for Longhorn system that haven’t been deployed. And it has no impact on the existing Longhorn system.

You should modify the settings for any existing Longhorn system via the Longhorn UI.

Via Rancher UI

[Cluster] -> System -> Apps -> Launch -> longhorn -> LONGHORN DEFAULT SETTINGS

Via Longhorn deployment YAML file

  1. Download the longhorn repo:

    1. git clone https://github.com/longhorn/longhorn.git
  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: s3://backupbucket@us-east-1/backupstore
    10. backup-target-credential-secret: minio-secret
    11. create-default-disk-labeled-nodes: true
    12. default-data-path: /var/lib/longhorn-example/
    13. replica-soft-anti-affinity: false
    14. storage-over-provisioning-percentage: 600
    15. storage-minimal-available-percentage: 15
    16. upgrade-checker: false
    17. default-replica-count: 2
    18. guaranteed-engine-cpu:
    19. default-longhorn-static-storage-class: longhorn-static-example
    20. backupstore-poll-interval: 500
    21. taint-toleration: key1=value1:NoSchedule; key2:NoExecute
    22. ---

Via helm

  1. Download the chart in the Longhorn repo:

    1. git clone https://github.com/longhorn/longhorn.git

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

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

2.2. Or directly modifying the default settings in the yaml file longhorn/chart/values.yaml then using helm command without --set to deploy Longhorn. For example:

In longhorn/chart/values.yaml:

  1. defaultSettings:
  2. backupTarget: s3://backupbucket@us-east-1/backupstore
  3. backupTargetCredentialSecret: minio-secret
  4. createDefaultDiskLabeledNodes: true
  5. defaultDataPath: /var/lib/longhorn-example/
  6. replicaSoftAntiAffinity: false
  7. storageOverProvisioningPercentage: 600
  8. storageMinimalAvailablePercentage: 15
  9. upgradeChecker: false
  10. defaultReplicaCount: 2
  11. guaranteedEngineCPU:
  12. defaultLonghornStaticStorageClass: longhorn-static-example
  13. backupstorePollInterval: 500
  14. taintToleration: key1=value1:NoSchedule; key2:NoExecute

Then use the helm command:

  1. helm install ./longhorn/chart --name longhorn --namespace longhorn-system

For more info about using helm, see: Install-Longhorn-with-helm

History

Original feature request

Available since v0.6.0