在 CSI 中使用 Linstor
CSI (Container Storage Interface) 是一种标准化的接口,用于在容器化环境中管理持久化存储。Linstor 是一个开源的块设备复制和分布式存储管理工具,它可以与 CSI 集成,为容器提供持久化存储支持。
要在 CSI 中使用 Linstor,需要执行以下步骤:
-
安装 Linstor:首先,您需要安装和配置 Linstor。可以参考 Linstor 的官方文档,根据您的操作系统和需求进行安装。
-
安装 CSI 驱动程序:接下来,您需要安装 Linstor 的 CSI 驱动程序。这通常是在 Kubernetes 集群中完成的,可以使用 kubectl 命令行工具或使用 YAML 文件部署 CSI 驱动程序的 DaemonSet。
-
创建 Linstor 存储池:在 Linstor 中,您需要创建一个或多个存储池(storage pool),以供容器使用。存储池定义了存储资源的属性和访问方式。
-
创建 PersistentVolumeClaim (PVC):在 Kubernetes 中,您需要创建一个 PVC 来请求持久化存储资源。在 PVC 对象中,指定 Linstor 存储池的名称、大小和其他相关属性。
-
创建 Pod:最后,在 Kubernetes 中创建一个 Pod,并将上一步中创建的 PVC 与该 Pod 关联。Pod 可以通过 VolumeMounts 将持久化存储挂载到容器中的指定路径。
通过这些步骤,您就可以在 CSI 中使用 Linstor 提供的持久化存储了。请注意,具体的操作细节可能因您的环境和需求而有所不同,因此建议参考 Linstor 和 Kubernetes 的官方文档以获取更详细的指导。
CSI存储
sts csi-linstor-0, choose one of: [resizer provisioner attacher driver]
ds csi-linstor-node-6qznx, choose one of: [node-driver-registrar linstor-csi-plugin]
sts csi-linstor-server-controller [controller]
kq get pod | grep csi
csi-linstor-0 4/4 Running 2 15h
csi-linstor-node-6qznx 2/2 Running 0 15h
csi-linstor-node-q6m8c 2/2 Running 0 15h
csi-linstor-server-controller-0 1/1 Running 0 15h
kq logs -f csi-linstor-node-hpkf4 -c node-driver-registrar
I0707 09:19:24.451851 1 main.go:108] Version: $(REV)
I0707 09:19:24.451905 1 main.go:115] Attempting to open a gRPC connection with: "/csi/csi.sock"
I0707 09:19:24.451916 1 connection.go:69] Connecting to /csi/csi.sock
I0707 09:19:24.452006 1 connection.go:96] Still trying, connection is CONNECTING
I0707 09:19:24.452256 1 connection.go:96] Still trying, connection is TRANSIENT_FAILURE
I0707 09:19:25.452590 1 connection.go:96] Still trying, connection is CONNECTING
I0707 09:19:25.452697 1 connection.go:93] Connected
I0707 09:19:25.452718 1 main.go:123] Calling CSI driver to discover driver name.
I0707 09:19:25.452730 1 connection.go:137] GRPC call: /csi.v1.Identity/GetPluginInfo
I0707 09:19:25.452738 1 connection.go:138] GRPC request: {}
I0707 09:19:25.458030 1 connection.go:140] GRPC response: {"name":"linstor.csi.linbit.com","vendor_version":"UNKNOWN"}
I0707 09:19:25.458488 1 connection.go:141] GRPC error: <nil>
I0707 09:19:25.458496 1 main.go:131] CSI driver name: "linstor.csi.linbit.com"
I0707 09:19:25.458525 1 node_register.go:54] Starting Registration Server at: /registration/linstor.csi.linbit.com-reg.sock
I0707 09:19:25.458680 1 node_register.go:61] Registration Server started at: /registration/linstor.csi.linbit.com-reg.sock
I0707 09:19:25.718974 1 main.go:76] Received GetInfo call: &InfoRequest{}
I0707 09:19:25.735613 1 main.go:86] Received NotifyRegistrationStatus call: &RegistrationStatus{PluginRegistered:true,Error:,}
根据日志分析,以下是对日志的内容和事件的解释:
I0707 09:19:24.451851 1 main.go:108] Version: $(REV)
:显示当前版本号为"$(REV)"。I0707 09:19:24.451905 1 main.go:115] Attempting to open a gRPC connection with: "/csi/csi.sock"
:尝试与"/csi/csi.sock"建立gRPC连接。I0707 09:19:24.451916 1 connection.go:69] Connecting to /csi/csi.sock
:正在连接到"/csi/csi.sock"。I0707 09:19:24.452006 1 connection.go:96] Still trying, connection is CONNECTING
:仍在尝试连接,连接状态为CONNECTING(正在连接)。I0707 09:19:24.452256 1 connection.go:96] Still trying, connection is TRANSIENT_FAILURE
:仍在尝试连接,连接状态为TRANSIENT_FAILURE(暂时失败)。I0707 09:19:25.452590 1 connection.go:96] Still trying, connection is CONNECTING
:仍在尝试连接,连接状态为CONNECTING。I0707 09:19:25.452697 1 connection.go:93] Connected
:已连接。I0707 09:19:25.452718 1 main.go:123] Calling CSI driver to discover driver name.
:调用CSI驱动程序以获取驱动程序名称。I0707 09:19:25.452730 1 connection.go:137] GRPC call: /csi.v1.Identity/GetPluginInfo
:进行GRPC调用,调用方法为/csi.v1.Identity/GetPluginInfo
。I0707 09:19:25.452738 1 connection.go:138] GRPC request: {}
:发送GRPC请求,请求为空。I0707 09:19:25.458030 1 connection.go:140] GRPC response: {"name":"linstor.csi.linbit.com","vendor_version":"UNKNOWN"}
:接收到GRPC响应,驱动程序的名称为"linstor.csi.linbit.com",供应商版本为"UNKNOWN"。I0707 09:19:25.458488 1 connection.go:141] GRPC error: <nil>
:没有GRPC错误。I0707 09:19:25.458496 1 main.go:131] CSI driver name: "linstor.csi.linbit.com"
:CSI驱动程序的名称是"linstor.csi.linbit.com"。I0707 09:19:25.458525 1 node_register.go:54] Starting Registration Server at: /registration/linstor.csi.linbit.com-reg.sock
:在"/registration/linstor.csi.linbit.com-reg.sock"上启动注册服务器。I0707 09:19:25.458680 1 node_register.go:61] Registration Server started at: /registration/linstor.csi.linbit.com-reg.sock
:注册服务器已在"/registration/linstor.csi.linbit.com-reg.sock"上启动。I0707 09:19:25.718974 1 main.go:76] Received GetInfo call: &InfoRequest{}
:收到GetInfo调用请求,请求为空。I0707 09:19:25.735613 1 main.go:86] Received NotifyRegistrationStatus call: &RegistrationStatus{PluginRegistered:true,Error:,}
:收到NotifyRegistrationStatus调用请求,插件已注册,没有错误。
这些日志显示了CSI驱动程序的启动过程。首先,尝试连接到"/csi/csi.sock",然后与该连接建立了gRPC连接。随后,调用CSI驱动程序以获取其名称,并成功收到响应。最后,启动了注册服务器,表示插件已注册。