部署
在Kubernetes集群中创建Longhorn的部署非常简单,您可以通过kubectl
工具直接运行以下命令镜进行安装。
kubectl --kubeconfig=kube_configxxx.yml apply -f https://raw.githubusercontent.com/rancher/longhorn/master/deploy/longhorn.yml
For Google Kubernetes Engine (GKE) users, see ../gke before proceeding.
Longhorn manager and Longhorn driver will be deployed as daemonsets in a separate namespace called longhorn-system
, as you can see in the yaml file.
One of the two available drivers (CSI and Flexvolume) would be chosen automatically based on the environment of the user. User can also override the automatic choice if necessary. See here for the detail.
Noted that the volume created and used through one driver won’t be recongized by Kubernetes using the other driver. So please don’t switch driver (e.g. during upgrade) if you have existing volumes created using the old driver.
When you see those pods have started correctly as follows, you’ve deployed Longhorn successfully.
If Longhorn was deployed with CSI driver (csi-attacher/csi-provisioner/longhorn-csi-plugin exists):
# kubectl --kubeconfig=kube_configxxx.yml -n longhorn-system get pod
NAME READY STATUS RESTARTS AGE
csi-attacher-0 1/1 Running 0 6h
csi-provisioner-0 1/1 Running 0 6h
engine-image-ei-57b85e25-8v65d 1/1 Running 0 7d
engine-image-ei-57b85e25-gjjs6 1/1 Running 0 7d
engine-image-ei-57b85e25-t2787 1/1 Running 0 7d
longhorn-csi-plugin-4cpk2 2/2 Running 0 6h
longhorn-csi-plugin-ll6mq 2/2 Running 0 6h
longhorn-csi-plugin-smlsh 2/2 Running 0 6h
longhorn-driver-deployer-7b5bdcccc8-fbncl 1/1 Running 0 6h
longhorn-manager-7x8x8 1/1 Running 0 6h
longhorn-manager-8kqf4 1/1 Running 0 6h
longhorn-manager-kln4h 1/1 Running 0 6h
longhorn-ui-f849dcd85-cgkgg 1/1 Running 0 5d
Or with FlexVolume driver (longhorn-flexvolume-driver exists):
# kubectl --kubeconfig=kube_configxxx.yml -n longhorn-system get pod
NAME READY STATUS RESTARTS AGE
engine-image-ei-57b85e25-8v65d 1/1 Running 0 7d
engine-image-ei-57b85e25-gjjs6 1/1 Running 0 7d
engine-image-ei-57b85e25-t2787 1/1 Running 0 7d
longhorn-driver-deployer-5469b87b9c-b9gm7 1/1 Running 0 2h
longhorn-flexvolume-driver-lth5g 1/1 Running 0 2h
longhorn-flexvolume-driver-tpqf7 1/1 Running 0 2h
longhorn-flexvolume-driver-v9mrj 1/1 Running 0 2h
longhorn-manager-7x8x8 1/1 Running 0 9h
longhorn-manager-8kqf4 1/1 Running 0 9h
longhorn-manager-kln4h 1/1 Running 0 9h
longhorn-ui-f849dcd85-cgkgg 1/1 Running 0 5d