https://github.com/wubomichael/longhorn/tree/master/deploy

https://blog.51cto.com/u_15168528/4290373

Longhorn | Documentation

【环境搭建】K8S存储:rook-ceph or Longhorn - 知乎

Longhorn,Kubernetes 云原生分布式块存储

https://blog.csdn.net/o__cc/article/details/120858474

Linux上open-iscsi 的安装,配置和使用 - 孤独的居士 - 博客园

longhorn/uninstall at master · longhorn/longhorn · GitHub

https://github.com/wubomichael/longhorn/tree/master/scripts

【环境搭建】K8S存储:rook-ceph or Longhorn - 知乎

轻量级Kubernetes k3s初探 - 知乎

Longhorn 云原生容器分布式存储 - 故障排除指南_o__cc的博客-CSDN博客

Longhorn 云原生容器分布式存储 - 故障排除指南【图文】_我是为少_51CTO博客

第一步(安装环境):安装open-iscsi(这个是基础设施,不管以何种方式安装都需要),此外还要Enable MountPropagation和其它的必要软件(curl,findmnt,grep,awk,blkid,lsblk

yum install iscsi-initiator-utils jq

关于安装环境可以先运行进行check

[root@jettoloader script]# cat environment_check.sh
#!/bin/bashdependencies() {local targets=($@)local allFound=truefor ((i=0; i<${#targets[@]}; i++)); dolocal target=${targets[$i]}if [ "$(which $target)" == "" ]; thenallFound=falseecho Not found: $targetfidoneif [ "$allFound" == "false" ]; thenecho "Please install missing dependencies."exit 2fi
}create_ds() {
cat <<EOF > $TEMP_DIR/environment_check.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:labels:app: longhorn-environment-checkname: longhorn-environment-check
spec:selector:matchLabels:app: longhorn-environment-checktemplate:metadata:labels:app: longhorn-environment-checkspec:containers:- name: longhorn-environment-checkimage: busyboxargs: ["/bin/sh", "-c", "sleep 1000000000"]volumeMounts:- name: mountpointmountPath: /tmp/longhorn-environment-checkmountPropagation: BidirectionalsecurityContext:privileged: truevolumes:- name: mountpointhostPath:path: /tmp/longhorn-environment-check
EOFkubectl create -f $TEMP_DIR/environment_check.yaml
}cleanup() {echo "cleaning up..."kubectl delete -f $TEMP_DIR/environment_check.yamlrm -rf $TEMP_DIRecho "clean up complete"
}wait_ds_ready() {while true; dolocal ds=$(kubectl get ds/longhorn-environment-check -o json)local numberReady=$(echo $ds | jq .status.numberReady)local desiredNumberScheduled=$(echo $ds | jq .status.desiredNumberScheduled)if [ "$desiredNumberScheduled" == "$numberReady" ] && [ "$desiredNumberScheduled" != "0" ]; thenecho "all pods ready ($numberReady/$desiredNumberScheduled)"returnfiecho "waiting for pods to become ready ($numberReady/$desiredNumberScheduled)"sleep 3done
}validate_ds() {local allSupported=truelocal pods=$(kubectl -l app=longhorn-environment-check get po -o json)local ds=$(kubectl get ds/longhorn-environment-check -o json)local desiredNumberScheduled=$(echo $ds | jq .status.desiredNumberScheduled)for ((i=0; i<desiredNumberScheduled; i++)); dolocal pod=$(echo $pods | jq .items[$i])local nodeName=$(echo $pod | jq -r .spec.nodeName)local mountPropagation=$(echo $pod | jq -r '.spec.containers[0].volumeMounts[] | select(.name=="mountpoint") | .mountPropagation')if [ "$mountPropagation" != "Bidirectional" ]; thenallSupported=falseecho "node $nodeName: MountPropagation DISABLED"fidoneif [ "$allSupported" != "true" ]; thenechoecho "  MountPropagation is disabled on at least one node."echo "  As a result, CSI driver and Base image cannot be supported."echoexit 1elseecho -e "\n  MountPropagation is enabled!\n"fi
}dependencies kubectl jq mktemp
TEMP_DIR=$(mktemp -d)
trap cleanup EXIT
create_ds
wait_ds_ready
validate_ds
exit 0

本人自己的longhorn.yaml

[root@jettoloader templates]# kubectl create -f longhorn.yamlapiVersion: v1
kind: Namespace
metadata:name: longhorn-system
---
apiVersion: v1
kind: ServiceAccount
metadata:name: longhorn-service-accountnamespace: longhorn-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:name: longhorn-role
rules:
- apiGroups:- apiextensions.k8s.ioresources:- customresourcedefinitionsverbs:- "*"
- apiGroups: [""]resources: ["pods", "events", "persistentvolumes", "persistentvolumeclaims","persistentvolumeclaims/status", "nodes", "proxy/nodes", "pods/log", "secrets", "services", "endpoints", "configmaps"]verbs: ["*"]
- apiGroups: [""]resources: ["namespaces"]verbs: ["get", "list"]
- apiGroups: ["apps"]resources: ["daemonsets", "statefulsets", "deployments"]verbs: ["*"]
- apiGroups: ["batch"]resources: ["jobs", "cronjobs"]verbs: ["*"]
- apiGroups: ["policy"]resources: ["poddisruptionbudgets"]verbs: ["*"]
- apiGroups: ["scheduling.k8s.io"]resources: ["priorityclasses"]verbs: ["watch", "list"]
- apiGroups: ["storage.k8s.io"]resources: ["storageclasses", "volumeattachments", "volumeattachments/status", "csinodes", "csidrivers"]verbs: ["*"]
- apiGroups: ["snapshot.storage.k8s.io"]resources: ["volumesnapshotclasses", "volumesnapshots", "volumesnapshotcontents", "volumesnapshotcontents/status"]verbs: ["*"]
- apiGroups: ["longhorn.io"]resources: ["volumes", "volumes/status", "engines", "engines/status", "replicas", "replicas/status", "settings","engineimages", "engineimages/status", "nodes", "nodes/status", "instancemanagers", "instancemanagers/status","sharemanagers", "sharemanagers/status", "backingimages", "backingimages/status","backingimagemanagers", "backingimagemanagers/status", "backingimagedatasources", "backingimagedatasources/status","backuptargets", "backuptargets/status", "backupvolumes", "backupvolumes/status", "backups", "backups/status","recurringjobs", "recurringjobs/status"]verbs: ["*"]
- apiGroups: ["coordination.k8s.io"]resources: ["leases"]verbs: ["*"]
- apiGroups: ["metrics.k8s.io"]resources: ["pods", "nodes"]verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:name: longhorn-bind
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: longhorn-role
subjects:
- kind: ServiceAccountname: longhorn-service-accountnamespace: longhorn-system
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: Enginename: engines.longhorn.io
spec:group: longhorn.ionames:kind: EnginelistKind: EngineListplural: enginesshortNames:- lhesingular: enginescope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: Statetype: stringdescription: The current state of the enginejsonPath: .status.currentState- name: Nodetype: stringdescription: The node that the engine is onjsonPath: .spec.nodeID- name: InstanceManagertype: stringdescription: The instance manager of the enginejsonPath: .status.instanceManagerName- name: Imagetype: stringdescription: The current image of the enginejsonPath: .status.currentImage- name: Agetype: datejsonPath: .metadata.creationTimestamp
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: Replicaname: replicas.longhorn.io
spec:group: longhorn.ionames:kind: ReplicalistKind: ReplicaListplural: replicasshortNames:- lhrsingular: replicascope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: Statetype: stringdescription: The current state of the replicajsonPath: .status.currentState- name: Nodetype: stringdescription: The node that the replica is onjsonPath: .spec.nodeID- name: Disktype: stringdescription: The disk that the replica is onjsonPath: .spec.diskID- name: InstanceManagertype: stringdescription: The instance manager of the replicajsonPath: .status.instanceManagerName- name: Imagetype: stringdescription: The current image of the replicajsonPath: .status.currentImage- name: Agetype: datejsonPath: .metadata.creationTimestamp
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: Settingname: settings.longhorn.io
spec:group: longhorn.ionames:kind: SettinglistKind: SettingListplural: settingsshortNames:- lhssingular: settingscope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:x-kubernetes-preserve-unknown-fields: trueadditionalPrinterColumns:- name: Valuetype: stringdescription: The value of the settingjsonPath: .value- name: Agetype: datejsonPath: .metadata.creationTimestamp
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: Volumename: volumes.longhorn.io
spec:group: longhorn.ionames:kind: VolumelistKind: VolumeListplural: volumesshortNames:- lhvsingular: volumescope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: Statetype: stringdescription: The state of the volumejsonPath: .status.state- name: Robustnesstype: stringdescription: The robustness of the volumejsonPath: .status.robustness- name: Scheduledtype: stringdescription: The scheduled condition of the volumejsonPath: .status.conditions['scheduled']['status']- name: Sizetype: stringdescription: The size of the volumejsonPath: .spec.size- name: Nodetype: stringdescription: The node that the volume is currently attaching tojsonPath: .status.currentNodeID- name: Agetype: datejsonPath: .metadata.creationTimestamp
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: EngineImagename: engineimages.longhorn.io
spec:group: longhorn.ionames:kind: EngineImagelistKind: EngineImageListplural: engineimagesshortNames:- lheisingular: engineimagescope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: Statetype: stringdescription: State of the engine imagejsonPath: .status.state- name: Imagetype: stringdescription: The Longhorn engine imagejsonPath: .spec.image- name: RefCounttype: integerdescription: Number of volumes are using the engine imagejsonPath: .status.refCount- name: BuildDatetype: datedescription: The build date of the engine imagejsonPath: .status.buildDate- name: Agetype: datejsonPath: .metadata.creationTimestamp
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: Nodename: nodes.longhorn.io
spec:group: longhorn.ionames:kind: NodelistKind: NodeListplural: nodesshortNames:- lhnsingular: nodescope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: Readytype: stringdescription: Indicate whether the node is readyjsonPath: .status.conditions['Ready']['status']- name: AllowSchedulingtype: booleandescription: Indicate whether the user disabled/enabled replica scheduling for the nodejsonPath: .spec.allowScheduling- name: Schedulabletype: stringdescription: Indicate whether Longhorn can schedule replicas on the nodejsonPath: .status.conditions['Schedulable']['status']- name: Agetype: datejsonPath: .metadata.creationTimestamp
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: InstanceManagername: instancemanagers.longhorn.io
spec:group: longhorn.ionames:kind: InstanceManagerlistKind: InstanceManagerListplural: instancemanagersshortNames:- lhimsingular: instancemanagerscope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: Statetype: stringdescription: The state of the instance managerjsonPath: .status.currentState- name: Typetype: stringdescription: The type of the instance manager (engine or replica)jsonPath: .spec.type- name: Nodetype: stringdescription: The node that the instance manager is running onjsonPath: .spec.nodeID- name: Agetype: datejsonPath: .metadata.creationTimestamp
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: ShareManagername: sharemanagers.longhorn.io
spec:group: longhorn.ionames:kind: ShareManagerlistKind: ShareManagerListplural: sharemanagersshortNames:- lhsmsingular: sharemanagerscope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: Statetype: stringdescription: The state of the share managerjsonPath: .status.state- name: Nodetype: stringdescription: The node that the share manager is owned byjsonPath: .status.ownerID- name: Agetype: datejsonPath: .metadata.creationTimestamp
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: BackingImagename: backingimages.longhorn.io
spec:group: longhorn.ionames:kind: BackingImagelistKind: BackingImageListplural: backingimagesshortNames:- lhbisingular: backingimagescope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: Imagetype: stringdescription: The backing image namejsonPath: .spec.image- name: Agetype: datejsonPath: .metadata.creationTimestamp
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: BackingImageManagername: backingimagemanagers.longhorn.io
spec:group: longhorn.ionames:kind: BackingImageManagerlistKind: BackingImageManagerListplural: backingimagemanagersshortNames:- lhbimsingular: backingimagemanagerscope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: Statetype: stringdescription: The current state of the managerjsonPath: .status.currentState- name: Imagetype: stringdescription: The image the manager pod will usejsonPath: .spec.image- name: Nodetype: stringdescription: The node the manager is onjsonPath: .spec.nodeID- name: DiskUUIDtype: stringdescription: The disk the manager is responsible forjsonPath: .spec.diskUUID- name: DiskPathtype: stringdescription: The disk path the manager is usingjsonPath: .spec.diskPath- name: Agetype: datejsonPath: .metadata.creationTimestamp
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: BackingImageDataSourcename: backingimagedatasources.longhorn.io
spec:group: longhorn.ionames:kind: BackingImageDataSourcelistKind: BackingImageDataSourceListplural: backingimagedatasourcesshortNames:- lhbidssingular: backingimagedatasourcescope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: Statetype: stringdescription: The current state of the pod used to provisione the backing image file from sourcejsonPath: .status.currentState- name: SourceTypetype: stringdescription: The data source typejsonPath: .spec.sourceType- name: Nodetype: stringdescription: The node the backing image file will be prepared onjsonPath: .spec.nodeID- name: DiskUUIDtype: stringdescription: The disk the backing image file will be prepared onjsonPath: .spec.diskUUID- name: Agetype: datejsonPath: .metadata.creationTimestamp
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: BackupTargetname: backuptargets.longhorn.io
spec:group: longhorn.ionames:kind: BackupTargetlistKind: BackupTargetListplural: backuptargetsshortNames:- lhbtsingular: backuptargetscope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: URLtype: stringdescription: The backup target URLjsonPath: .spec.backupTargetURL- name: Credentialtype: stringdescription: The backup target credential secretjsonPath: .spec.credentialSecret- name: Intervaltype: stringdescription: The backup target poll intervaljsonPath: .spec.pollInterval- name: Availabletype: booleandescription: Indicate whether the backup target is available or notjsonPath: .status.available- name: LastSyncedAttype: stringdescription: The backup target last synced timejsonPath: .status.lastSyncedAt
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: BackupVolumename: backupvolumes.longhorn.io
spec:group: longhorn.ionames:kind: BackupVolumelistKind: BackupVolumeListplural: backupvolumesshortNames:- lhbvsingular: backupvolumescope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: CreatedAttype: stringdescription: The backup volume creation timejsonPath: .status.createdAt- name: LastBackupNametype: stringdescription: The backup volume last backup namejsonPath: .status.lastBackupName- name: LastBackupAttype: stringdescription: The backup volume last backup timejsonPath: .status.lastBackupAt- name: LastSyncedAttype: stringdescription: The backup volume last synced timejsonPath: .status.lastSyncedAt
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: Backupname: backups.longhorn.io
spec:group: longhorn.ionames:kind: BackuplistKind: BackupListplural: backupsshortNames:- lhbsingular: backupscope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: SnapshotNametype: stringdescription: The snapshot namejsonPath: .status.snapshotName- name: SnapshotSizetype: stringdescription: The snapshot sizejsonPath: .status.size- name: SnapshotCreatedAttype: stringdescription: The snapshot creation timejsonPath: .status.snapshotCreatedAt- name: Statetype: stringdescription: The backup statejsonPath: .status.state- name: LastSyncedAttype: stringdescription: The backup last synced timejsonPath: .status.lastSyncedAt
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:longhorn-manager: RecurringJobname: recurringjobs.longhorn.io
spec:group: longhorn.ionames:kind: RecurringJoblistKind: RecurringJobListplural: recurringjobsshortNames:- lhrjsingular: recurringjobscope: Namespacedversions:- name: v1beta1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:metadata:type: objectproperties:name:type: stringspec:type: objectproperties:groups:type: arrayitems:type: stringtask:type: stringpattern: "^snapshot|backup$"cron:type: stringretain:type: integerconcurrency:type: integerlabels:x-kubernetes-preserve-unknown-fields: truestatus:x-kubernetes-preserve-unknown-fields: truesubresources:status: {}additionalPrinterColumns:- name: Groupstype: stringdescription: Sets groupings to the jobs. When set to "default" group will be added to the volume label when no other job label exist in volume.jsonPath: .spec.groups- name: Tasktype: stringdescription: Should be one of "backup" or "snapshot".jsonPath: .spec.task- name: Crontype: stringdescription: The cron expression represents recurring job scheduling.jsonPath: .spec.cron- name: Retaintype: integerdescription: The number of snapshots/backups to keep for the volume.jsonPath: .spec.retain- name: Concurrencytype: integerdescription: The concurrent job to run by each cron job.jsonPath: .spec.concurrency- name: Agetype: datejsonPath: .metadata.creationTimestamp- name: Labelstype: stringdescription: Specify the labelsjsonPath: .spec.labels
---
---
apiVersion: v1
kind: ConfigMap
metadata:name: longhorn-default-settingnamespace: 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:replica-auto-balance:storage-over-provisioning-percentage:storage-minimal-available-percentage:upgrade-checker:default-replica-count:default-data-locality: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:node-down-pod-deletion-policy:allow-node-drain-with-last-healthy-replica:mkfs-ext4-parameters:disable-replica-rebuild:replica-replenishment-wait-interval:concurrent-replica-rebuild-per-node-limit: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:backing-image-recovery-wait-interval:guaranteed-engine-manager-cpu:guaranteed-replica-manager-cpu:
---
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:name: longhorn-psp
spec:privileged: trueallowPrivilegeEscalation: truerequiredDropCapabilities:- NET_RAWallowedCapabilities:- SYS_ADMINhostNetwork: falsehostIPC: falsehostPID: truerunAsUser:rule: RunAsAnyseLinux:rule: RunAsAnyfsGroup:rule: RunAsAnysupplementalGroups:rule: RunAsAnyvolumes:- configMap- downwardAPI- emptyDir- secret- projected- hostPath
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:name: longhorn-psp-rolenamespace: longhorn-system
rules:- apiGroups:- policyresources:- podsecuritypoliciesverbs:- useresourceNames:- longhorn-psp
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:name: longhorn-psp-bindingnamespace: longhorn-system
roleRef:apiGroup: rbac.authorization.k8s.iokind: Rolename: longhorn-psp-role
subjects:- kind: ServiceAccountname: longhorn-service-accountnamespace: longhorn-system- kind: ServiceAccountname: defaultnamespace: longhorn-system
---
apiVersion: v1
kind: ConfigMap
metadata:name: longhorn-storageclassnamespace: longhorn-system
data:storageclass.yaml: |kind: StorageClassapiVersion: storage.k8s.io/v1metadata:name: longhornprovisioner: driver.longhorn.ioallowVolumeExpansion: truereclaimPolicy: DeletevolumeBindingMode: Immediateparameters:fsType: "ext4"numberOfReplicas: "3"staleReplicaTimeout: "2880"fromBackup: ""#  backingImage: "bi-test"#  backingImageDataSourceType: "download"#  backingImageDataSourceParameters: '{"url": "https://backing-image-example.s3-region.amazonaws.com/test-backing-image"}'#  backingImageChecksum: "SHA512 checksum of the backing image"#  diskSelector: "ssd,fast"#  nodeSelector: "storage,fast"#  recurringJobSelector: '[{"name":"snap-group", "isGroup":true},#                          {"name":"backup", "isGroup":false}]'
---
apiVersion: apps/v1
kind: DaemonSet
metadata:labels:app: longhorn-managername: longhorn-managernamespace: longhorn-system
spec:selector:matchLabels:app: longhorn-managertemplate:metadata:labels:app: longhorn-managerspec:containers:- name: longhorn-managerimage: 172.16.10.21:5000/jettechtools/k3s/longhornio/longhorn-manager:v1.2.3imagePullPolicy: IfNotPresentsecurityContext:privileged: truecommand:- longhorn-manager- -d- daemon- --engine-image- 172.16.10.21:5000/jettechtools/k3s/longhornio/longhorn-engine:v1.2.3- --instance-manager-image- 172.16.10.21:5000/jettechtools/k3s/longhornio/longhorn-instance-manager:v1_20211210- --share-manager-image- 172.16.10.21:5000/jettechtools/k3s/longhornio/longhorn-share-manager:v1_20211020- --backing-image-manager-image- 172.16.10.21:5000/jettechtools/k3s/longhornio/backing-image-manager:v2_20210820- --manager-image- 172.16.10.21:5000/jettechtools/k3s/longhornio/longhorn-manager:v1.2.3- --service-account- longhorn-service-accountports:- containerPort: 9500name: managerreadinessProbe:tcpSocket:port: 9500volumeMounts:- name: devmountPath: /host/dev/- name: procmountPath: /host/proc/- name: longhornmountPath: /var/lib/longhorn/mountPropagation: Bidirectional- name: longhorn-default-settingmountPath: /var/lib/longhorn-setting/env:- name: POD_NAMESPACEvalueFrom:fieldRef:fieldPath: metadata.namespace- name: POD_IPvalueFrom:fieldRef:fieldPath: status.podIP- name: NODE_NAMEvalueFrom:fieldRef:fieldPath: spec.nodeName# Should be: mount path of the volume longhorn-default-setting + the key of the configmap data in 04-default-setting.yaml- name: DEFAULT_SETTING_PATHvalue: /var/lib/longhorn-setting/default-setting.yamlvolumes:- name: devhostPath:path: /dev/- name: prochostPath:path: /proc/- name: longhornhostPath:path: /var/lib/longhorn/- name: longhorn-default-settingconfigMap:name: longhorn-default-setting
#      imagePullSecrets:
#      - name: ""
#      priorityClassName:
#      tolerations:
#      - key: "key"
#        operator: "Equal"
#        value: "value"
#        effect: "NoSchedule"
#      nodeSelector:
#        label-key1: "label-value1"
#        label-key2: "label-value2"serviceAccountName: longhorn-service-accountupdateStrategy:rollingUpdate:maxUnavailable: "100%"
---
apiVersion: v1
kind: Service
metadata:labels:app: longhorn-managername: longhorn-backendnamespace: longhorn-system
spec:type: ClusterIPsessionAffinity: ClientIPselector:app: longhorn-managerports:- name: managerport: 9500targetPort: manager
---
apiVersion: v1
kind: Service
metadata:name: longhorn-engine-managernamespace: longhorn-system
spec:clusterIP: Noneselector:longhorn.io/component: instance-managerlonghorn.io/instance-manager-type: engine
---
apiVersion: v1
kind: Service
metadata:name: longhorn-replica-managernamespace: longhorn-system
spec:clusterIP: Noneselector:longhorn.io/component: instance-managerlonghorn.io/instance-manager-type: replica
---
apiVersion: apps/v1
kind: Deployment
metadata:labels:app: longhorn-uiname: longhorn-uinamespace: longhorn-system
spec:replicas: 1selector:matchLabels:app: longhorn-uitemplate:metadata:labels:app: longhorn-uispec:containers:- name: longhorn-uiimage: 172.16.10.21:5000/jettechtools/k3s/longhornio/longhorn-ui:v1.2.3imagePullPolicy: IfNotPresentsecurityContext:runAsUser: 0ports:- containerPort: 8000name: httpenv:- name: LONGHORN_MANAGER_IPvalue: "http://longhorn-backend:9500"
#      imagePullSecrets:
#        - name: ""
#      priorityClassName:
#      tolerations:
#      - key: "key"
#        operator: "Equal"
#        value: "value"
#        effect: "NoSchedule"
#      nodeSelector:
#        label-key1: "label-value1"
#        label-key2: "label-value2"
---
kind: Service
apiVersion: v1
metadata:labels:app: longhorn-uiname: longhorn-frontendnamespace: longhorn-system
spec:type: ClusterIPselector:app: longhorn-uiports:- name: httpport: 80targetPort: httpnodePort: null
---
apiVersion: apps/v1
kind: Deployment
metadata:name: longhorn-driver-deployernamespace: longhorn-system
spec:replicas: 1selector:matchLabels:app: longhorn-driver-deployertemplate:metadata:labels:app: longhorn-driver-deployerspec:initContainers:- name: wait-longhorn-managerimage: 172.16.10.21:5000/jettechtools/k3s/longhornio/longhorn-manager:v1.2.3command: ['sh', '-c', 'while [ $(curl -m 1 -s -o /dev/null -w "%{http_code}" http://longhorn-backend:9500/v1) != "200" ]; do echo waiting; sleep 2; done']containers:- name: longhorn-driver-deployerimage: 172.16.10.21:5000/jettechtools/k3s/longhornio/longhorn-manager:v1.2.3imagePullPolicy: IfNotPresentcommand:- longhorn-manager- -d- deploy-driver- --manager-image- longhornio/longhorn-manager:v1.2.3- --manager-url- http://longhorn-backend:9500/v1env:- name: POD_NAMESPACEvalueFrom:fieldRef:fieldPath: metadata.namespace- name: NODE_NAMEvalueFrom:fieldRef:fieldPath: spec.nodeName- name: SERVICE_ACCOUNTvalueFrom:fieldRef:fieldPath: spec.serviceAccountName# Manually set root directory for csi#- name: KUBELET_ROOT_DIR#  value: /var/lib/rancher/k3s/agent/kubelet# For AirGap Installation# Replace PREFIX with your private registry- name: CSI_ATTACHER_IMAGE#value: PREFIX/csi-attacher:v3.2.1value: 172.16.10.21:5000/jettechtools/k3s/longhornio/csi-attacher:v3.2.1- name: CSI_PROVISIONER_IMAGEvalue: 172.16.10.21:5000/jettechtools/k3s/longhornio/csi-provisioner:v2.1.2- name: CSI_NODE_DRIVER_REGISTRAR_IMAGEvalue: 172.16.10.21:5000/jettechtools/k3s/longhornio/csi-node-driver-registrar:v2.3.0- name: CSI_RESIZER_IMAGEvalue: 172.16.10.21:5000/jettechtools/k3s/longhornio/csi-resizer:v1.2.0- name: CSI_SNAPSHOTTER_IMAGEvalue: 172.16.10.21:5000/jettechtools/k3s/longhornio/csi-snapshotter:v3.0.3# Manually specify number of CSI attacher replicas- name: CSI_ATTACHER_REPLICA_COUNTvalue: "3"# Manually specify number of CSI provisioner replicas- name: CSI_PROVISIONER_REPLICA_COUNTvalue: "3"- name: CSI_RESIZER_REPLICA_COUNTvalue: "3"- name: CSI_SNAPSHOTTER_REPLICA_COUNTvalue: "3"
#      imagePullSecrets:
#        - name: ""
#      priorityClassName:
#      tolerations:
#      - key: "key"
#        operator: "Equal"
#        value: "value"
#        effect: "NoSchedule"
#      nodeSelector:
#        label-key1: "label-value1"
#        label-key2: "label-value2"serviceAccountName: longhorn-service-accountsecurityContext:runAsUser: 0
---
[root@jettoloader templates]# kubectl proxy --port=8081
[root@jettoloader templates]# kubectl get ns longhorn-system -o json > tmp.json
删除文件中剩下"spec": {"finalizers": []}[root@jettoloader templates]# curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json 127.0.0.1:8081/api/v1/namespaces/longhorn-system/finalize
[root@localhost ~]#  kubectl get pod,svc -n longhorn-system
NAME                                            READY   STATUS    RESTARTS      AGE
pod/longhorn-ui-9fdb94f9-6gsgh                  1/1     Running   0             16m
pod/instance-manager-r-ebac9d9e                 1/1     Running   0             16m
pod/instance-manager-e-e0f2dcf6                 1/1     Running   0             16m
pod/longhorn-manager-x6gnt                      1/1     Running   0             16m
pod/instance-manager-r-82543544                 1/1     Running   0             16m
pod/instance-manager-e-bd6c09e1                 1/1     Running   0             16m
pod/engine-image-ei-39018db3-x4lzt              1/1     Running   0             16m
pod/longhorn-driver-deployer-58cd7995d7-chrsl   1/1     Running   0             16m
pod/instance-manager-e-f4f61183                 1/1     Running   0             16m
pod/instance-manager-r-f145de14                 1/1     Running   0             16m
pod/engine-image-ei-39018db3-4mj7s              1/1     Running   0             16m
pod/engine-image-ei-39018db3-6znzn              1/1     Running   0             16m
pod/csi-attacher-5f46994f7-78vhn                1/1     Running   0             16m
pod/csi-attacher-5f46994f7-sv6cx                1/1     Running   0             16m
pod/csi-provisioner-6ccbfbf86f-wjjsg            1/1     Running   0             16m
pod/csi-attacher-5f46994f7-dcxjw                1/1     Running   0             16m
pod/csi-resizer-6dd8bd4c97-9gs79                1/1     Running   0             16m
pod/longhorn-manager-c4xxm                      1/1     Running   1 (16m ago)   16m
pod/csi-provisioner-6ccbfbf86f-62vbl            1/1     Running   0             16m
pod/csi-provisioner-6ccbfbf86f-4mlds            1/1     Running   0             16m
pod/csi-resizer-6dd8bd4c97-z9289                1/1     Running   0             16m
pod/longhorn-manager-7ljlt                      1/1     Running   1 (16m ago)   16m
pod/csi-resizer-6dd8bd4c97-qqcl4                1/1     Running   0             16m
pod/csi-snapshotter-86f65d8bc-dbfdb             1/1     Running   0             16m
pod/csi-snapshotter-86f65d8bc-qtnd6             1/1     Running   0             16m
pod/csi-snapshotter-86f65d8bc-mj28t             1/1     Running   0             16m
pod/longhorn-csi-plugin-z9bvg                   2/2     Running   0             16m
pod/longhorn-csi-plugin-vtfjh                   2/2     Running   0             16m
pod/longhorn-csi-plugin-xb2kl                   2/2     Running   0             16mNAME                               TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
service/longhorn-backend           NodePort    10.43.109.94    <none>        9500:9400/TCP   16m
service/longhorn-engine-manager    ClusterIP   None            <none>        <none>          16m
service/longhorn-replica-manager   ClusterIP   None            <none>        <none>          16m
service/longhorn-frontend          NodePort    10.43.176.130   <none>        80:9999/TCP     16m
service/csi-attacher               ClusterIP   10.43.129.91    <none>        12345/TCP       16m
service/csi-provisioner            ClusterIP   10.43.18.75     <none>        12345/TCP       16m
service/csi-resizer                ClusterIP   10.43.67.133    <none>        12345/TCP       16m
service/csi-snapshotter            ClusterIP   10.43.143.27    <none>        12345/TCP       16m

longhorn介绍相关推荐

  1. Forefront基本知识介绍

    Forefront 如今的商业领域,经常采用来自不同厂商的安全解决方案来保护不同类型的网络.这些解决方案有时候可以很好的协同工作,有时候却相互冲突.解决这些冲 突并不容易,而不同解决方案的不同界面和管 ...

  2. 跟本菜菜一起去体验Microsoft Windows Server Code Name Longhorn Server Core

    消失的菜菜又回来了,这段时间由于很多原因没及时更新blog,忘大家见谅-还记得菜菜以前给大家介绍的Microsoft Windows Server Longhorn吗?今天我给大家带来Microsof ...

  3. windows的由来与详细介绍

    目录 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> · • ...

  4. windows 介绍

    第1章 前言--Windows的含义 词典中的中文意思:窗户; 橱窗; 窗玻璃, 窗状开口 在计算机中的含义:微软(Microsoft)公司开发的"视窗"操作系统. 第2章 Mic ...

  5. windows家族介绍

    Windows标志目录 第1章 前言--Windows的含义 第2章 windows的类别 第3章 Microsoft Windows 第4章 Windows 系列 第5章 Microsoft Win ...

  6. 什么是RIA?介绍几种RIA客户端开发技术

    什么是RIA? RIA(Rich Interface Applications)富界面应用,俗称胖客户端或者富客户端. RIA的优势 RIA 具有的桌面应用程序的特点包括:在消息确认和格式编排方面提供 ...

  7. K8S,k3s 分布式存储:rook-ceph or Longhorn

    K8S的Volume Volume的主要功能是为了持久化容器的数据,Volume 的生命周期独立于容器,Pod 中的容器可能被销毁和重建,但 Volume 会被保留.本质上,Kubernetes Vo ...

  8. 在Linux系统中运行.net程序——Mono介绍

    Mono介绍 来源:互联网 收集:梦幻网络 本站网址:www.7139.com 点击数: <script src="http://www.7139.com/jsxy/GetHits.a ...

  9. Adobe AIR 介绍

    Adobe  AIR 介绍 Adobe Integrated Runtime (AIR) 是一个跨操作系统的运行时,利用现有的Web开发技术(Flash,Flex,HTML,JavaScript,Aj ...

  10. 关于EFI的一点介绍

    本文主要分为如下几个部分: 1, EFI Overview :主要从整体上去描述一下什么是EFI.以及应用EFI对我们可能带来的好处. 2, Framework : 从原理,架构等几个方面重点介绍了E ...

最新文章

  1. 22. datenum Matlab中的日期型数据处理函数
  2. String构造方法和字符集编码转换
  3. python两个切片合并_Python中numpy的布尔判断、合并、切片及一般函数,通用
  4. 反射通过配置文件运行的步骤
  5. mysql触发器不起作用 navicat的bug?
  6. 电脑微信扫一扫在哪_13个微信隐藏技巧,至少有10个你不知道
  7. 【C++】C++类和对象
  8. 使用yarn运行react项目指令_Jenkins | 使用yarn构建前端项目
  9. 一张图彻底了解Unity脚本的生命周期
  10. vue脚手架的自定义配置
  11. tcpip详解卷一arp 地址解析协议
  12. Mozilla发布开发者专用浏览器Fx10
  13. 机器学习Machine Learning学习笔记——回归Regression
  14. 反射Modifier
  15. 713页鸿蒙巨作《鸿蒙HarmonyOS手机应用开发实战》简介
  16. 数据分析型产品的需求分析6大步骤
  17. 详解迭代器的 fail-fast 与 fail-safe 机制
  18. ue4 改变枢轴位置_[UE4蓝图][Materials]虚幻4中可互动的雪地材质完整实现(一)
  19. 基于spring boot的毕业设计论文选题申报管理系统设计与实现 毕业论文+项目源码、
  20. 使用Python对大脑成像数据进行可视化分析

热门文章

  1. POJ 1118 Lining Up 叉积,三点共线。
  2. sammy1989 python生成html报告
  3. lowB三人组---冒泡排序原理和实现
  4. 目标检测研究现状调研
  5. 1118 Birds in Forest (25分)
  6. 串口服务器主要作用,串口服务器到底能干啥,作用,一看便知!
  7. 广义瑞利商_瑞利商和广义瑞利商
  8. Ubuntu18.04设置自动连接WIFI
  9. linux网络编程常用头文件总结
  10. 新浪短网址t.cn如何生成