Main changes and tasks for OCP are:
Only required if you require additional customizations, such as storage-less nodes, or secondary disks.
Label each node for storage with:
oc get nodes --no-headers | awk '{print $1}' export NODE="worker-0" oc label node "${NODE}" node.longhorn.io/create-default-disk=true
On the storage nodes create a filesystem with the label longhorn:
oc get nodes --no-headers | awk '{print $1}' export NODE="worker-0" oc debug node/${NODE} -t -- chroot /host bash # Validate Target Drive is Present lsblk export DRIVE="sdb" #vdb sudo mkfs.ext4 -L longhorn /dev/${DRIVE}
⚠️ Note: If you add New Nodes After the below Machine Config is applied, you will need to also reboot the node.
The Secondary Drive needs to be mounted on every boot. Save the Concents and Apply the MachineConfig with oc apply -f:
⚠️ This will trigger an machine config profile update and reboot all worker nodes on the cluster
apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig metadata: labels: machineconfiguration.openshift.io/role: worker name: 71-mount-storage-worker spec: config: ignition: version: 3.2.0 systemd: units: - name: var-mnt-longhorn.mount enabled: true contents: | [Unit] Before=local-fs.target [Mount] Where=/var/mnt/longhorn What=/dev/disk/by-label/longhorn Options=rw,relatime,discard [Install] WantedBy=local-fs.target
Label and annotate storage nodes like this:
oc get nodes --no-headers | awk '{print $1}' export NODE="worker-0" oc annotate node ${NODE} --overwrite node.longhorn.io/default-disks-config='[{"path":"/var/mnt/longhorn","allowScheduling":true}]' oc label node ${NODE} node.longhorn.io/create-default-disk=config
Minimum Adjustments Required
openshift: oauthProxy: repository: quay.io/openshift/origin-oauth-proxy tag: 4.15 # Use Your OCP/OKD 4.X Version, Current Stable is 4.15 # defaultSettings: # Preparing nodes (Optional) # createDefaultDiskLabeledNodes: true openshift: enabled: true ui: route: "longhorn-ui" port: 443 proxy: 8443
# helm template ./chart/ --namespace longhorn-system --values ./chart/values.yaml --no-hooks > longhorn.yaml # Local Testing helm template longhorn --namespace longhorn-system --values values.yaml --no-hooks > longhorn.yaml oc create namespace longhorn-system -o yaml --dry-run=client | oc apply -f - oc apply -f longhorn.yaml -n longhorn-system