GitHub文檔地址:https://github.com/minio/directpv
DirectPV是用於直連存儲的CSI驅動程序。從更簡單的意義上講,它是一個分布式持久卷管理器,而不是像SAN或NAS這樣的存儲系統。跨服務器發現、格式化、裝載、調度和監視驅動器非常有用。由於Kubernetes hostPath和本地PV是靜態配置的,並且功能有限,因此創建DirectPV就是為了解決這一限制。
分布式數據存儲(如對象存儲、數據庫和消息隊列)是為直連存儲而設計的,它們自行處理高可用性和數據持久性。在傳統的SAN或基於NAS的CSI驅動程序(Network PV)上運行它們會在數據路徑中添加另一層復制/擦除編碼和額外的網絡跳數。這種額外的分解層會導致復雜性增加和性能降低。

結構
DirectPV設計為輕量級,可擴展到1000個驅動器中的10個。它由三個組件組成:控制器、節點驅動程序、用戶界面

1.控制器
在進行卷聲明時,控制器會從無池驅動器統一調配卷。DirectPV知道pod的關聯約束,並將卷從本地驅動器分配到pod。請注意,每個群集只運行一個活動的controller實例。
2.節點驅動程序
節點驅動程序實現卷管理功能,例如發現、格式化、裝載和監視節點上的驅動器。每個存儲服務器上都運行一個節點驅動程序實例。
3.用戶界面
存儲管理員可以使用kubectl CLI插件來選擇、管理和監視驅動器。基於Web的UI目前正在開發中。
Installation
# Install kubectl directpv plugin
# kubectl krew install directpv
Updated the local copy of plugin index.
Installing plugin: directpv
Installed plugin: directpv
\
| Use this plugin:
| kubectl directpv
| Documentation:
| https://github.com/minio/directpv
/
WARNING: You installed plugin "directpv" from the krew-index plugin repository.
These plugins are not audited for security by the Krew maintainers.
Run them at your own risk.
# Use the plugin to install directpv in your kubernetes cluster
# kubectl directpv install
I0316 10:39:32.252897 26592 install.go:95] Enable dynamic drive change management using --enable-dynamic-discovery flag
W0316 10:39:32.253005 26592 install.go:97] dynamic-discovery feature is strictly experimental and NOT production ready yet
I0316 10:39:32.291954 26592 ns.go:55] 'direct.csi.min.io' namespace created
I0316 10:39:32.339038 26592 rbac.go:352] 'direct.csi.min.io' rbac created
I0316 10:39:32.665041 26592 psp.go:129] 'direct.csi.min.io' podsecuritypolicy created
I0316 10:39:42.759152 26592 conversion_secret.go:170] 'direct.csi.min.io' conversion webhook secrets created
I0316 10:39:42.889964 26592 crd.go:135] crds successfully registered
I0316 10:39:43.113506 26592 csidriver.go:150] 'direct.csi.min.io' csidriver created
I0316 10:39:43.244882 26592 storageclass.go:50] 'direct.csi.min.io' storageclass created
I0316 10:39:43.277386 26592 service.go:39] 'direct.csi.min.io' service created
I0316 10:39:43.335130 26592 daemonset.go:41] 'direct.csi.min.io' daemonset created
I0316 10:39:43.474387 26592 deployment.go:295] 'direct.csi.min.io' deployment created
# Ensure directpv has successfully started
# 查看pod創建events,會有報錯,才導致info信息沒有的
# kubectl directpv info
ERR: directpv installation NOT found
run 'kubectl directpv install' to get started
ERROR directpv installation not found
# List available drives in your cluster
kubectl directpv drives ls
# Select drives that directpv should manage and format
kubectl directpv drives format --drives /dev/sd{a...f} --nodes directpv-{1...4}
# 'directpv' can now be specified as the storageclass in PodSpec.VolumeClaimTemplates



