The content is from the official Longhorn 1.1.2 English technical manual.

A series of

  • What’s a Longhorn?
  • Longhorn Cloud Native Container Distributed Storage – Design architecture and concepts
  • Longhorn Cloud Native Container Distributed Storage – Deployment chapter
  • Longhorn Cloud Native Container distributed storage – coupons and nodes
  • Longhorn Cloud Native Container Distributed Storage – K8S resource configuration example
  • Longhorn Cloud Native Container Distributed Storage – Monitoring (Prometheus)
  • Longhorn Cloud Native Container Distributed storage – backup and restore
  • Longhorn Cloud Native Container distributed storage – high availability
  • Longhorn Cloud Native Container distributed storage – Supports ReadWriteMany (RWX) workloads

You can customize Longhorn’s default Settings when you deploy it. For example, you can specify Create Default Disk With Node Labeled(Create Default Disk With Node label) and Default Data Path(Default Data Path) before starting Longhorn.

This default setting only applies to Longhorn systems that have not yet been deployed. It has no effect on the existing Longhorn system. The setup of any existing Longhorn system should be modified using the Longhorn UI.

You can customize the default Settings by:

  • useRancher UI
  • useLonghorn Deployment YAMLfile
  • useHelm

Use the Rancher UI

In Rancher’s project view, go to Apps > Launch > Longhorn and edit the Settings before launching the application.

Use the Longhorn Deployment YAML file

  1. Download the longhorn repo:

    git clone https://github.com/longhorn/longhorn.git
    Copy the code
  2. Modify longhorn yaml files/deploy/longhorn yaml called longhorn – default config map – setting. Such as:

    ---
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: longhorn-default-setting
      namespace: longhorn-system
    data:
      default-setting.yaml: |-
        backup-target:
        backup-target-credential-secret:
        allow-recurring-job-while-volume-detached:
        create-default-disk-labeled-nodes:
        default-data-path:
        replica-soft-anti-affinity:
        storage-over-provisioning-percentage:
        storage-minimal-available-percentage:
        upgrade-checker:
        default-replica-count:
        default-data-locality:
        guaranteed-engine-cpu:
        default-longhorn-static-storage-class:
        backupstore-poll-interval:
        taint-toleration:
        system-managed-components-node-selector:
        priority-class:
        auto-salvage:
        auto-delete-pod-when-volume-detached-unexpectedly:
        disable-scheduling-on-cordoned-node:
        replica-zone-soft-anti-affinity:
        volume-attachment-recovery-policy:
        node-down-pod-deletion-policy:
        allow-node-drain-with-last-healthy-replica:
        mkfs-ext4-parameters:
        disable-replica-rebuild:
        replica-replenishment-wait-interval:
        disable-revision-counter:
        system-managed-pods-image-pull-policy:
        allow-volume-creation-with-degraded-availability:
        auto-cleanup-system-generated-snapshot:
        concurrent-automatic-engine-upgrade-per-node-limit:
        backing-image-cleanup-wait-interval:
        guaranteed-engine-manager-cpu:
        guaranteed-replica-manager-cpu:
    ---
    Copy the code

Use the Helm

Use the Helm command with the –set flag to change the default Settings. Such as:

helm install longhorn/longhorn \
--name longhorn \
--namespace longhorn-system \
--set defaultSettings.taintToleration="key1=value1:NoSchedule; key2:NoExecute"
Copy the code

You can also provide a copy of the values.yaml file with the default setting changed to the –values flag when running the Helm command:

  1. Get a copy of the values. Yaml file from GitHub:

    curl -Lo values.yaml https://raw.githubusercontent.com/longhorn/charts/master/charts/longhorn/values.yaml
    Copy the code
  2. Modify the default Settings in the YAML file. Here is a sample snippet of values.yaml:

    defaultSettings:
      backupTarget: s3://backupbucket@us-east-1/backupstore
      backupTargetCredentialSecret: minio-secret
      createDefaultDiskLabeledNodes: true
      defaultDataPath: /var/lib/longhorn-example/
      replicaSoftAntiAffinity: false
      storageOverProvisioningPercentage: 600
      storageMinimalAvailablePercentage: 15
      upgradeChecker: false
      defaultReplicaCount: 2
      defaultDataLocality: disabled
      guaranteedEngineCPU:
      defaultLonghornStaticStorageClass: longhorn-static-example
      backupstorePollInterval: 500
      taintToleration: key1=value1:NoSchedule; key2:NoExecute
      systemManagedComponentsNodeSelector: "label-key1:label-value1"
      priority-class: high-priority
      autoSalvage: false
      disableSchedulingOnCordonedNode: false
      replicaZoneSoftAntiAffinity: false
      volumeAttachmentRecoveryPolicy: never
      nodeDownPodDeletionPolicy: do-nothing
      mkfsExt4Parameters: -O ^64bit,^metadata_csum
      guaranteed-engine-manager-cpu: 15
      guaranteed-replica-manager-cpu: 15
    Copy the code
  3. Run the Helm with values.yaml:

    helm install longhorn/longhorn --name longhorn --namespace longhorn-system --values values.yaml
    Copy the code