### Complete fleet.yaml for Longhorn Installation Source: https://longhorn.io/docs/1.13.0/deploy/install/install-with-fleet An example of a complete `fleet.yaml` file that includes namespace, Helm chart details, and CRD diff configurations for installing Longhorn. ```yaml defaultNamespace: longhorn-system helm: repo: https://charts.longhorn.io chart: longhorn version: v1.13.0 releaseName: longhorn diff: comparePatches: - apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition name: engineimages.longhorn.io operations: - {"op": "replace", "path": "/status"} - apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition name: nodes.longhorn.io operations: - {"op": "replace", "path": "/status"} - apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition name: volumes.longhorn.io operations: - {"op": "replace", "path": "/status"} ``` -------------------------------- ### Example Successful Longhorn Installation Source: https://longhorn.io/docs/1.13.0/deploy/install/install-with-flux This output shows a typical list of running pods after a successful Longhorn installation in the longhorn-system namespace. ```text NAME READY STATUS RESTARTS AGE longhorn-ui-b7c844b49-w25g5 1/1 Running 0 2m41s longhorn-manager-pzgsp 1/1 Running 0 2m41s longhorn-driver-deployer-6bd59c9f76-lqczw 1/1 Running 0 2m41s longhorn-csi-plugin-mbwqz 2/2 Running 0 100s csi-snapshotter-588457fcdf-22bqp 1/1 Running 0 100s csi-snapshotter-588457fcdf-2wd6g 1/1 Running 0 100s csi-provisioner-869bdc4b79-mzrwf 1/1 Running 0 101s csi-provisioner-869bdc4b79-klgfm 1/1 Running 0 101s csi-resizer-6d8cf5f99f-fd2ck 1/1 Running 0 101s csi-provisioner-869bdc4b79-j46rx 1/1 Running 0 101s csi-snapshotter-588457fcdf-bvjdt 1/1 Running 0 100s csi-resizer-6d8cf5f99f-68cw7 1/1 Running 0 101s csi-attacher-7bf4b7f996-df8v6 1/1 Running 0 101s csi-attacher-7bf4b7f996-g9cwc 1/1 Running 0 101s csi-attacher-7bf4b7f996-8l9sw 1/1 Running 0 101s csi-resizer-6d8cf5f99f-smdjw 1/1 Running 0 101s instance-manager-b34d5db1fe1e2d52bcfb308be3166cfc 1/1 Running 0 114s engine-image-ei-df38d2e5-cv6nc 1/1 Running 0 114s ``` -------------------------------- ### Install Longhorn Preflight Dependencies Source: https://longhorn.io/docs/1.13.0/advanced-resources/longhornctl Perform preflight dependencies installation and setup before installing Longhorn. ```bash longhornctl install preflight ``` -------------------------------- ### Install Cryptsetup on SUSE/OpenSUSE Source: https://longhorn.io/docs/1.13.0/deploy/install Installs the cryptsetup tool for LUKS2 disk encryption on SUSE and OpenSUSE. ```bash zypper install cryptsetup ``` -------------------------------- ### Backup Configuration Example Source: https://longhorn.io/docs/1.13.0/advanced-resources/data-recovery/recover-without-system This is an example of the backup.cfg content, which contains the backup name and volume name needed for restoration. ```json {"Name":"backup-72bcbdad913546cf","VolumeName":"volume_1","SnapshotName":"79758033-a670-4724-906f-41921f53c475"} ``` -------------------------------- ### Get Kubelet Logs (Native Installation) Source: https://longhorn.io/docs/1.13.0/troubleshoot/troubleshooting Retrieve logs from the Kubelet service when it is running natively on the node. This is relevant for troubleshooting FlexVolume driver issues. ```bash journalctl -u kubelet ``` -------------------------------- ### Example Output: IOMMU Enabled Source: https://longhorn.io/docs/1.13.0/advanced-resources/v2-data-engine/interrupt-mode This is an example of the expected output when IOMMU is enabled, showing device paths within IOMMU groups. ```bash /sys/kernel/iommu_groups/0/devices/0000:e6:0b.1 /sys/kernel/iommu_groups/1/devices/0000:34:0a.6 /sys/kernel/iommu_groups/2/devices/0000:a0:00.0 ``` -------------------------------- ### Install Device Mapper on SUSE/OpenSUSE Source: https://longhorn.io/docs/1.13.0/deploy/install Installs the device mapper userspace tool on SUSE and OpenSUSE. ```bash zypper install device-mapper ``` -------------------------------- ### Install V2 Data Engine Prerequisites Source: https://longhorn.io/docs/1.13.0/deploy/install Execute this command to install prerequisites for the V2 Data Engine, including SPDK support. This requires the `--enable-spdk` flag. ```bash longhornctl --kubeconfig ~/.kube/config --image longhornio/longhorn-cli:v1.13.0 install preflight --enable-spdk ``` -------------------------------- ### Default StorageClass Parameters Example Source: https://longhorn.io/docs/1.13.0/deploy/upgrade/longhorn-manager This snippet shows the default parameters for a StorageClass, which should be verified before upgrading if Longhorn was installed via Helm or as a Rancher catalog app. ```yaml parameters: numberOfReplicas: staleReplicaTimeout: "30" fromBackup: "" baseImage: "" ``` -------------------------------- ### Install Cryptsetup on Debian/Ubuntu Source: https://longhorn.io/docs/1.13.0/deploy/install Installs the cryptsetup tool for LUKS2 disk encryption on Debian and Ubuntu. ```bash apt-get install cryptsetup ``` -------------------------------- ### Install NFSv4 Client on SUSE/OpenSUSE Source: https://longhorn.io/docs/1.13.0/deploy/install Installs the NFSv4 client userspace daemon and utilities on SUSE and OpenSUSE. ```bash zypper install nfs-client ``` -------------------------------- ### Install V1 Data Engine Prerequisites Source: https://longhorn.io/docs/1.13.0/deploy/install Run this command to install the default prerequisites for the V1 Data Engine. Ensure your kubeconfig is correctly set. ```bash longhornctl --kubeconfig ~/.kube/config --image longhornio/longhorn-cli:v1.13.0 install preflight ``` -------------------------------- ### Basic Longhorn Installation with HTTPRoute Enabled Source: https://longhorn.io/docs/1.13.0/deploy/accessing-the-ui/longhorn-httproute Installs Longhorn using Helm, enabling HTTPRoute generation and configuring basic parent references and hostnames for the Longhorn UI. ```bash helm install longhorn longhorn/longhorn \ --namespace longhorn-system \ --create-namespace \ --set "httproute.enabled=true" \ --set "httproute.parentRefs[0].name=my-gateway" \ --set "httproute.parentRefs[0].namespace=default" \ --set "httproute.hostnames[0]=longhorn.example.com" ``` -------------------------------- ### Install longhornctl Binary Source: https://longhorn.io/docs/1.13.0/advanced-resources/longhornctl/install-longhornctl Install the verified longhornctl binary to a system directory, making it accessible from the command line. ```bash sudo install longhornctl-linux-${ARCH} /usr/local/bin/longhornctl ``` -------------------------------- ### Install Argo CD Source: https://longhorn.io/docs/1.13.0/deploy/install/install-with-argocd Installs Argo CD into the 'argocd' namespace and applies the core installation manifest. ```bash kubectl create namespace argocd kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/core-install.yaml ``` -------------------------------- ### Install iscsi-initiator-utils on RHEL/CentOS/EKS Source: https://longhorn.io/docs/1.13.0/deploy/install Installs the iscsi-initiator-utils package, configures the initiator name, and enables/starts the iscsid daemon on RHEL, CentOS, and EKS worker nodes. ```shell yum --setopt=tsflags=noscripts install iscsi-initiator-utils echo "InitiatorName=$(/sbin/iscsi-iname)" > /etc/iscsi/initiatorname.iscsi systemctl enable iscsid systemctl start iscsid ``` -------------------------------- ### Install Common Snapshot Controller Source: https://longhorn.io/docs/1.13.0/snapshots-and-backups/csi-snapshot-support/enable-csi-snapshot-support Installs the common snapshot controller for CSI snapshots. This should be done once per cluster. Ensure the namespace is updated to an appropriate value for your environment before installation. ```bash kubectl create -k deploy/kubernetes/snapshot-controller ``` -------------------------------- ### Install Device Mapper on Debian/Ubuntu Source: https://longhorn.io/docs/1.13.0/deploy/install Installs the device mapper userspace tool on Debian and Ubuntu. ```bash apt-get install dmsetup ``` -------------------------------- ### Kubernetes Block Volume Example Source: https://longhorn.io/docs/1.13.0/references/examples This example demonstrates how to create a PersistentVolumeClaim with volumeMode set to Block and a Pod that uses this block device. ```yaml apiVersion: v1 kind: PersistentVolumeClaim metadata: name: longhorn-block-vol spec: accessModes: - ReadWriteOnce volumeMode: Block storageClassName: longhorn resources: requests: storage: 2Gi --- apiVersion: v1 kind: Pod metadata: name: block-volume-test namespace: default spec: containers: - name: block-volume-test image: nginx:stable-alpine imagePullPolicy: IfNotPresent volumeDevices: - devicePath: /dev/longhorn/testblk name: block-vol ports: - containerPort: 80 volumes: - name: block-vol persistentVolumeClaim: claimName: longhorn-block-vol ``` -------------------------------- ### Install open-iscsi on SUSE/openSUSE Source: https://longhorn.io/docs/1.13.0/deploy/install Installs the open-iscsi package and enables/starts the iscsid daemon on SUSE and openSUSE systems. ```shell zypper install open-iscsi systemctl enable iscsid systemctl start iscsid ``` -------------------------------- ### Kubernetes StatefulSet Example Source: https://longhorn.io/docs/1.13.0/references/examples This example demonstrates a Kubernetes StatefulSet configuration for an Nginx deployment, including a Service and volume claim template for persistent storage managed by Longhorn. ```yaml apiVersion: v1 kind: Service metadata: name: nginx labels: app: nginx spec: ports: - port: 80 name: web selector: app: nginx type: NodePort --- apiVersion: apps/v1 kind: StatefulSet metadata: name: web spec: selector: matchLabels: app: nginx # has to match .spec.template.metadata.labels serviceName: "nginx" replicas: 2 # by default is 1 template: metadata: labels: app: nginx # has to match .spec.selector.matchLabels spec: restartPolicy: Always terminationGracePeriodSeconds: 10 containers: - name: nginx image: registry.k8s.io/nginx-slim:0.8 livenessProbe: exec: command: - ls - /usr/share/nginx/html/lost+found initialDelaySeconds: 5 periodSeconds: 5 ports: - containerPort: 80 name: web volumeMounts: - name: www mountPath: /usr/share/nginx/html volumeClaimTemplates: - metadata: name: www spec: accessModes: [ "ReadWriteOnce" ] storageClassName: "longhorn" resources: requests: storage: 1Gi ``` -------------------------------- ### Kubernetes Deployment with Persistent Storage Example Source: https://longhorn.io/docs/1.13.0/references/examples This example defines a MySQL deployment, including a Service, a PersistentVolumeClaim for storage, and the Deployment configuration itself. It mounts the persistent volume to /var/lib/mysql. ```yaml apiVersion: v1 kind: Service metadata: name: mysql labels: app: mysql spec: ports: - port: 3306 selector: app: mysql clusterIP: None --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: mysql-pvc spec: accessModes: - ReadWriteOnce storageClassName: longhorn resources: requests: storage: 2Gi --- apiVersion: apps/v1 kind: Deployment metadata: name: mysql labels: app: mysql spec: selector: matchLabels: app: mysql # has to match .spec.template.metadata.labels strategy: type: Recreate template: metadata: labels: app: mysql spec: restartPolicy: Always containers: - image: mysql:5.6 name: mysql livenessProbe: exec: command: - ls - /var/lib/mysql/lost+found initialDelaySeconds: 5 periodSeconds: 5 env: - name: MYSQL_ROOT_PASSWORD value: changeme ports: - containerPort: 3306 name: mysql volumeMounts: - name: mysql-volume mountPath: /var/lib/mysql volumes: - name: mysql-volume persistentVolumeClaim: claimName: mysql-pvc ``` -------------------------------- ### Watch Longhorn Pods Installation Source: https://longhorn.io/docs/1.13.0/advanced-resources/os-distro-specific/okd-support Monitor the creation of Longhorn pods in the `longhorn-system` namespace during installation. ```bash oc get pods \ --namespace longhorn-system \ --watch ``` -------------------------------- ### Install Longhorn with Helm Source: https://longhorn.io/docs/1.13.0/deploy/install/airgap Install Longhorn using Helm after configuring the `chart/values.yaml` file for airgapped deployment. ```bash helm install longhorn ./chart --namespace longhorn-system --create-namespace ``` -------------------------------- ### Example: Full Workflow with Verification Source: https://longhorn.io/docs/1.13.0/deploy/accessing-the-ui/longhorn-ingress Demonstrates a complete workflow including generating credentials, creating the secret, applying the Ingress, and verifying access with curl. This example shows the practical application of the preceding steps. ```bash $ USER=foo; PASSWORD=bar; echo "${USER}:$(openssl passwd -stdin -apr1 <<< ${PASSWORD})" >> auth $ cat auth foo:$apr1$FnyKCYKb$6IP2C45fZxMcoLwkOwf7k0 $ kubectl -n longhorn-system create secret generic basic-auth --from-file=auth secret/basic-auth created $ kubectl -n longhorn-system get secret basic-auth -o yaml apiVersion: v1 data: auth: Zm9vOiRhcHIxJEZueUtDWUtiJDZJUDJDNDVmWnhNY29Md2tPd2Y3azAK kind: Secret metadata: creationTimestamp: "2020-05-29T10:10:16Z" name: basic-auth namespace: longhorn-system resourceVersion: "2168509" selfLink: /api/v1/namespaces/longhorn-system/secrets/basic-auth uid: 9f66233f-b12f-4204-9c9d-5bcaca794bb7 type: Opaque $ echo " apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: longhorn-ingress namespace: longhorn-system annotations: # type of authentication nginx.ingress.kubernetes.io/auth-type: basic # prevent the controller from redirecting (308) to HTTPS nginx.ingress.kubernetes.io/ssl-redirect: 'false' # name of the secret that contains the user/password definitions nginx.ingress.kubernetes.io/auth-secret: basic-auth # message to display with an appropriate context why the authentication is required nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required ' spec: rules: - http: paths: - pathType: Prefix path: "/" backend: service: name: longhorn-frontend port: number: 80 " | kubectl -n longhorn-system create -f - ingress.networking.k8s.io/longhorn-ingress created $ kubectl -n longhorn-system get ingress NAME HOSTS ADDRESS PORTS AGE longhorn-ingress * 45.79.165.114,66.228.45.37,97.107.142.125 80 2m7s $ curl -v http://97.107.142.125/ * Trying 97.107.142.125... * TCP_NODELAY set * Connected to 97.107.142.125 (97.107.142.125) port 80 (#0) > GET / HTTP/1.1 > Host: 97.107.142.125 > User-Agent: curl/7.64.1 > Accept: */* > < HTTP/1.1 401 Unauthorized < Server: openresty/1.15.8.1 < Date: Fri, 29 May 2020 11:47:33 GMT < Content-Type: text/html < Content-Length: 185 < Connection: keep-alive < WWW-Authenticate: Basic realm="Authentication Required" < ``` -------------------------------- ### Example Longhorn Service Output Source: https://longhorn.io/docs/1.13.0/deploy/accessing-the-ui This is an example output from the 'kubectl get svc' command for Longhorn v0.8.0 and later. It shows the ClusterIP of the longhorn-frontend service, which is used to access the UI. ```yaml NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE longhorn-backend ClusterIP 10.20.248.250 9500/TCP 58m longhorn-frontend ClusterIP 10.20.245.110 80/TCP 58m ``` -------------------------------- ### Configuring Multiple Disks for New Nodes Before Launch Source: https://longhorn.io/docs/1.13.0/nodes-and-volumes/nodes/default-disk-and-node-config This example shows how to configure multiple disks for new nodes by applying both a label and a disk configuration annotation before launching Longhorn. It also indicates the Longhorn deployment setting. ```yaml node.longhorn.io/create-default-disk: 'config' ``` ```yaml node.longhorn.io/default-disks-config: '[ { "path":"/var/lib/longhorn", "allowScheduling":true }, { "name":"fast-ssd-disk", "path":"/mnt/extra", "allowScheduling":false, "storageReserved":10485760, "tags":[ "ssd", "fast" ] }]' ``` -------------------------------- ### Get Kubelet Logs (Containerized Installation) Source: https://longhorn.io/docs/1.13.0/troubleshoot/troubleshooting Retrieve logs from the Kubelet service when it is running as a container, such as in RKE environments. This is relevant for troubleshooting FlexVolume driver issues. ```bash docker logs kubelet ``` -------------------------------- ### Enable and Start iSCSI Daemon Source: https://longhorn.io/docs/1.13.0/advanced-resources/os-distro-specific/csi-on-rke-and-coreos Enables the systemd service for the iSCSI daemon to ensure it starts automatically at boot. Alternatively, it can be started for the current session. ```bash sudo su systemctl enable iscsid reboot ``` ```bash sudo su systemctl start iscsid ``` -------------------------------- ### Deploy Backupstore Credentials and Service Source: https://longhorn.io/docs/1.13.0/snapshots-and-backups/backup-and-restore/set-backup-target Applies the generated Kustomize overlay to deploy the backupstore credentials and associated service. ```bash kubectl apply -k deploy/backupstores/overlays/generated-credentials/azurite ``` -------------------------------- ### Apply GRUB Configuration (UEFI) Source: https://longhorn.io/docs/1.13.0/deploy/install Generate the GRUB configuration file for UEFI systems, specifying the correct distro path. ```bash sudo grub2-mkconfig -o /boot/efi/EFI//grub.cfg ``` -------------------------------- ### Install Linux Kernel Extra Modules (Debian/Ubuntu) Source: https://longhorn.io/docs/1.13.0/troubleshoot/troubleshooting Install the necessary Linux kernel extra modules for Debian-based systems. This resolves installation errors related to missing kernel modules. ```bash apt update -y apt install -y linux-modules-extra-5.15.0-76-generic ``` -------------------------------- ### Install open-iscsi on Debian/Ubuntu Source: https://longhorn.io/docs/1.13.0/deploy/install Installs the open-iscsi package on Debian and Ubuntu systems. ```shell apt-get install open-iscsi ``` -------------------------------- ### Verify longhornctl Installation Source: https://longhorn.io/docs/1.13.0/advanced-resources/longhornctl/install-longhornctl Confirm that longhornctl has been installed correctly by checking its version. ```bash longhornctl version ``` -------------------------------- ### Add Fleet Helm Repository and Install Fleet Source: https://longhorn.io/docs/1.13.0/deploy/install/install-with-fleet Add the Fleet Helm repository and install Fleet components, including CRDs, into the `cattle-fleet-system` namespace. Ensure the `--wait` flag is used for synchronous installation. ```bash helm repo add fleet https://rancher.github.io/fleet-helm-charts/ helm -n cattle-fleet-system install --create-namespace --wait fleet-crd fleet/fleet-crd helm -n cattle-fleet-system install --create-namespace --wait fleet fleet/fleet ``` -------------------------------- ### Example: Triggering On-Demand Checksum for All Volumes Source: https://longhorn.io/docs/1.13.0/advanced-resources/data-integrity/on-demand-snapshot-data-integrity Demonstrates the command to trigger on-demand snapshot checksum calculation for all volumes and its expected output. ```bash ./longhornctl-linux-amd64 checksum volume --all=true ``` ```text INFO[2026-03-18T17:04:27+08:00] Triggering on-demand snapshot checksum calculation INFO[2026-03-18T17:04:27+08:00] Requested on-demand checksum calculation for volume tmp1 volume=tmp1 INFO[2026-03-18T17:04:27+08:00] Requested on-demand checksum calculation for volume tmp2 volume=tmp2 INFO[2026-03-18T17:04:27+08:00] Snapshot checksum calculation may take some time. You can check the snapshot checksum via kubectl. INFO[2026-03-18T17:04:27+08:00] Checksum request submitted INFO[2026-03-18T17:04:27+08:00] Cleaning volume on-demand checksum requester INFO[2026-03-18T17:04:27+08:00] Completed volume on-demand checksum requester ``` -------------------------------- ### Apply GRUB Configuration (RHEL/SUSE) Source: https://longhorn.io/docs/1.13.0/deploy/install Generate the GRUB configuration file for RHEL or SUSE systems with GRUB2. ```bash sudo grub2-mkconfig -o /boot/grub2/grub.cfg ``` -------------------------------- ### Install Snapshot CRDs Source: https://longhorn.io/docs/1.13.0/snapshots-and-backups/csi-snapshot-support/enable-csi-snapshot-support Installs the Custom Resource Definitions for CSI snapshots. This should be done once per cluster. ```bash kubectl create -k client/config/crd ``` -------------------------------- ### Create Custom StorageClass with Node and Disk Tags Source: https://longhorn.io/docs/1.13.0/nodes-and-volumes/nodes/storage-tags This example demonstrates creating a custom StorageClass named 'longhorn-fast' to provision volumes using disks tagged 'ssd' and nodes tagged 'storage' and 'fast'. ```yaml kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: longhorn-fast provisioner: driver.longhorn.io parameters: numberOfReplicas: "3" staleReplicaTimeout: "480" # 8 hours in minutes diskSelector: "ssd" nodeSelector: "storage,fast" ``` -------------------------------- ### Verify Longhorn Installation Source: https://longhorn.io/docs/1.13.0/deploy/install/install-with-argocd Checks the status of Longhorn pods in the 'longhorn-system' namespace to confirm a successful installation. ```bash kubectl -n longhorn-system get pod ``` -------------------------------- ### Deploy CIFS Credentials and Service Source: https://longhorn.io/docs/1.13.0/snapshots-and-backups/backup-and-restore/set-backup-target Applies the generated Kustomize overlay to deploy the CIFS credentials and associated service. This makes the SMB/CIFS backupstore available to Longhorn. ```bash kubectl apply -k deploy/backupstores/overlays/generated-credentials/cifs ``` -------------------------------- ### Install NFSv4 Client on Debian/Ubuntu Source: https://longhorn.io/docs/1.13.0/deploy/install Installs the NFSv4 client userspace daemon and utilities on Debian and Ubuntu systems. ```bash apt-get install nfs-common ``` -------------------------------- ### Create Backing Image via StorageClass (Download) Source: https://longhorn.io/docs/1.13.0/advanced-resources/backing-image/backing-image Use this StorageClass configuration to instruct Longhorn to download a backing image during volume creation if it doesn't exist. Ensure the URL is correctly escaped. ```yaml kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: longhorn-backing-image-example provisioner: driver.longhorn.io allowVolumeExpansion: true reclaimPolicy: Delete volumeBindingMode: Immediate parameters: numberOfReplicas: "3" staleReplicaTimeout: "2880" backingImage: "bi-download" backingImageDataSourceType: "download" backingImageDataSourceParameters: '{"url": "https://backing-image-example.s3-region.amazonaws.com/test-backing-image"}' backingImageChecksum: "SHA512 checksum of the backing image" backingImageMinNumberOfCopies: "2" backingImageNodeSelector: "node1" backingImageDiskSelector: "disk1" dataEngine: "v1" ``` -------------------------------- ### NFSv4 Client Installation Requirement Source: https://longhorn.io/docs/1.13.0/nodes-and-volumes/volumes/rwx-volumes Ensures the NFSv4 client is installed on each node for generic RWX volumes. This is a prerequisite for mounting the volumes. ```text for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount. helper program. ``` -------------------------------- ### Generate Backupstore Credentials Overlay Source: https://longhorn.io/docs/1.13.0/snapshots-and-backups/backup-and-restore/set-backup-target Generates Kustomize overlay files for MinIO backupstore credentials. This script prepares the necessary configuration for deployment. ```bash ./scripts/generate-backupstore-credentials.sh minio --no-encode ``` -------------------------------- ### Setting Operations Source: https://longhorn.io/docs/1.13.0/references/longhorn-client-python Examples of how to retrieve and update Longhorn settings using the Python client. ```APIDOC ## Setting Operations ### Description Provides methods to list, retrieve, and update Longhorn settings. ### Methods - `list_setting()`: Lists all settings. - `by_id_setting(id: str)`: Retrieves a specific setting by its ID. - `update(setting_object, value: str)`: Updates the value of a setting. ### Example Usage ```python # Assuming client is an initialized Longhorn Client object # List all settings settings = client.list_setting() # Get setting by NAME/ID backupTargetsetting = client.by_id_setting(id="backup-target") # Update a setting backupTargetsetting = client.update(backupTargetsetting, value="s3://backupbucket@us-east-1/") ``` ``` -------------------------------- ### Install NFSv4 Client on RHEL/CentOS/AmazonLinux2 Source: https://longhorn.io/docs/1.13.0/deploy/install Installs the NFSv4 client userspace daemon and utilities on RHEL, CentOS, and Amazon Linux 2. ```bash yum install nfs-utils ``` -------------------------------- ### Apply HelmChart CR to Install Longhorn Source: https://longhorn.io/docs/1.13.0/deploy/install/install-with-helm-controller Apply the created HelmChart CR to your Kubernetes cluster to initiate the Longhorn installation job. ```bash $ kubectl apply -f helmchart_repo_install.yaml helmchart.helm.cattle.io/longhorn-install created ``` -------------------------------- ### Enable Detailed Longhorn FlexVolume Driver Logs Source: https://longhorn.io/docs/1.13.0/troubleshoot/troubleshooting Create a log file to capture detailed logs for the Longhorn FlexVolume driver. This can be done on the node or within a container if Kubelet is containerized. ```bash touch /var/log/longhorn_driver.log ``` -------------------------------- ### Install Gateway API CRDs Source: https://longhorn.io/docs/1.13.0/deploy/accessing-the-ui/longhorn-httproute Installs the necessary Custom Resource Definitions for the Gateway API. Ensure you have version 1.2.0 or later. ```bash kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.0/standard-install.yaml ``` -------------------------------- ### Kubernetes CSI Persistent Volume Example Source: https://longhorn.io/docs/1.13.0/references/examples This example shows a PersistentVolume, PersistentVolumeClaim, and Pod configuration for using Longhorn as a CSI driver. It includes volume attributes like number of replicas and stale replica timeout. ```yaml apiVersion: v1 kind: PersistentVolume metadata: name: longhorn-vol-pv spec: capacity: storage: 2Gi volumeMode: Filesystem accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Delete storageClassName: longhorn csi: driver: driver.longhorn.io fsType: ext4 volumeAttributes: numberOfReplicas: '3' staleReplicaTimeout: '2880' volumeHandle: existing-longhorn-volume --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: longhorn-vol-pvc spec: accessModes: - ReadWriteOnce resources: requests: storage: 2Gi volumeName: longhorn-vol-pv storageClassName: longhorn --- apiVersion: v1 kind: Pod metadata: name: volume-pv-test namespace: default spec: restartPolicy: Always containers: - name: volume-pv-test image: nginx:stable-alpine imagePullPolicy: IfNotPresent livenessProbe: exec: command: - ls - /data/lost+found initialDelaySeconds: 5 periodSeconds: 5 volumeMounts: - name: vol mountPath: /data ports: - containerPort: 80 volumes: - name: vol persistentVolumeClaim: claimName: longhorn-vol-pvc ``` -------------------------------- ### Generate Kustomize Overlay for Backupstore Credentials Source: https://longhorn.io/docs/1.13.0/snapshots-and-backups/backup-and-restore/set-backup-target Generates a Kustomize overlay for backupstore credentials using a provided script. Use `--no-encode` if environment variables are already base64-encoded. ```bash ./scripts/generate-backupstore-credentials.sh azurite ``` -------------------------------- ### Install Longhorn on OKD with Helm Source: https://longhorn.io/docs/1.13.0/advanced-resources/os-distro-specific/okd-support Use this command to install Longhorn on an OKD cluster using Helm, enabling OpenShift-specific configurations. ```bash helm install longhorn longhorn/longhorn \ --namespace longhorn-system \ --create-namespace \ --set openshift.enabled=true \ --set image.openshift.oauthProxy.repository=quay.io/openshift/origin-oauth-proxy \ --set image.openshift.oauthProxy.tag=4.18 ``` -------------------------------- ### Run Preflight Check (V2 Data Engine) Source: https://longhorn.io/docs/1.13.0/deploy/install Perform a preflight check with longhornctl, enabling the `--enable-spdk` flag to validate additional requirements for the V2 Data Engine. ```bash ./longhornctl check preflight --enable-spdk ```