文档: https://longhorn.io/docs/1.7.1/
安装
kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.7.1/deploy/longhorn.yaml
需要给服务 longhorn-frontend
开启外部访问
创建一个选择一组特定节点的 StorageClass
- 在所有节点上正常安装 Longhorn
- 进入Longhorn UI的节点页面,给节点添加标签
创建一个具有节点选择器的新 StorageClass
nodeSelector: "tag"
。
- 例:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: longhorn-de
annotations:
storageclass.kubesphere.io/supported-access-modes:
- ReadWriteOnce
labels:
storage.kubesphere.io/storagetype: BlockStorage
provisioner: driver.longhorn.io
parameters:
nodeSelector: 'de'
fsType: "ext4"
numberOfReplicas: "3"
staleReplicaTimeout: "2880"
fromBackup: ""
reclaimPolicy: Delete
allowVolumeExpansion: 'true'
volumeBindingMode: Immediate