Skip to content

Commit ac3c503

Browse files
Merge pull request opencurve#42 from bai-charisu/master
add k8s csi doc
2 parents 6b68be6 + 5d41ac7 commit ac3c503

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ CURVE是网易自主设计研发的高性能、高可用、高可靠分布式存
1212
- [Chunkserver](docs/cn/chunkserver_design.md)
1313
- [Snapshotcloneserver](docs/cn/snapshotcloneserver.md)
1414
- [CURVE质量体系介绍](docs/cn/quality.md)
15+
- CURVE上层应用
16+
- [对接k8s文档](docs/cn/k8s_csi_interface.md)
1517

1618
## 快速开始
1719

docs/cn/k8s_csi_interface.md

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
目前,curve可以通过CSI插件的方式对接Kubernetes。本文给出的是CSI插件开发指导说明。内部使用的Curve CSI插件目前在联调测试中,后续会开源出来。
2+
3+
## Curve Interface
4+
5+
curve提供命令行管理工具curve,用来创建、删除卷等管理操作。具体接口如下:
6+
7+
- 创建卷:`curve create [-h] --filename FILENAME --length LENGTH --user USER`
8+
- 删除卷:`curve delete [-h] --user USER --filename FILENAME`
9+
- 扩容卷:`curve extend [-h] --user USER --filename FILENAME --length LENGTH`
10+
- 查询卷:`curve stat [-h] --user USER --filename FILENAME`
11+
- rename卷:`curve rename [-h] --user USER --filename FILENAME --newname NEWNAME`
12+
- 创建目录:`curve mkdir [-h] --user USER --dirname DIRNAME`
13+
- 删除目录:`curve rmdir [-h] --user USER --dirname DIRNAME`
14+
- 查询目录下所有文件:`curve list [-h] --user USER --dirname DIRNAME`
15+
16+
提供curve-nbd工具,在node节点上提供map,unmap,list功能:
17+
18+
```bash
19+
Usage: curve-nbd [options] map <image> (Map an image to nbd device)
20+
unmap <device|image> (Unmap nbd device)
21+
list-mapped (List mapped nbd devices)
22+
Map options:
23+
--device <device path> Specify nbd device path (/dev/nbd{num})
24+
--read-only Map read-only
25+
--nbds_max <limit> Override for module param nbds_max
26+
--max_part <limit> Override for module param max_part
27+
--timeout <seconds> Set nbd request timeout
28+
--try-netlink Use the nbd netlink interface
29+
```
30+
31+
## Implementing with Kubernetes CSI
32+
33+
CSI spec:
34+
35+
```
36+
CreateVolume +------------+ DeleteVolume
37+
+------------->| CREATED +--------------+
38+
| +---+----^---+ |
39+
| Controller | | Controller v
40+
+++ Publish | | Unpublish +++
41+
|X| Volume | | Volume | |
42+
+-+ +---v----+---+ +-+
43+
| NODE_READY |
44+
+---+----^---+
45+
Node | | Node
46+
Stage | | Unstage
47+
Volume | | Volume
48+
+---v----+---+
49+
| VOL_READY |
50+
+---+----^---+
51+
Node | | Node
52+
Publish | | Unpublish
53+
Volume | | Volume
54+
+---v----+---+
55+
| PUBLISHED |
56+
+------------+
57+
```
58+
59+
CSI插件的对应:
60+
61+
- CreateVolume:
62+
- curve mkdir: DIRNAME在`k8s storageClass`定义
63+
- curve create: FILENAME为`k8s persistentVolume name`
64+
- curve stat: 等待卷ready
65+
- Controller Publish Volume:
66+
- Nothing to do
67+
- Node Stage Volume:
68+
- curve-nbd list-mapped: 查看是否已经被挂载
69+
- curve-nbd map: 挂载
70+
- Node Publish Volume:
71+
- mount the stagePath to the publishPath
72+
- Node Unpublish Volume:
73+
- umount publishPath
74+
- Node Unstage Volume:
75+
- curve-nbd list-mapped: 查看是否已经被卸载
76+
- curve-nbd unmap: 卸载
77+
- Controller Unpublish Volume:
78+
- Nothing to do
79+
- DeleteVolume:
80+
- curve delete
81+
82+
其他可选支持:
83+
84+
- 扩容:
85+
- ControllerExpandVolume: curve extend
86+
- NodeExpandVolume: resize2fs/xfs_growfs
87+
88+
- 快照:暂未支持

0 commit comments

Comments
 (0)