-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add CSI application reference documentation
- Loading branch information
1 parent
fe94442
commit 39bc7df
Showing
1 changed file
with
187 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
|
||
# 前言 | ||
|
||
本文档从细节入手,比较多种不同存储驱动,主要提供给产品PM、研发和测试人员进行参考。 | ||
|
||
--- | ||
|
||
## 2. 存储资源 | ||
|
||
### 2.1 StorageClass | ||
|
||
```yaml | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: csi-cephfs-sc | ||
provisiner: cephfs.csi.ceph.com | ||
parameters: | ||
key: value | ||
reclaimPolicy: Delete | ||
allowVolumeExpansion: true | ||
volumeBidingMode: Immediate | ||
allowedTopologies: | ||
- matchLabelExpressions: | ||
- key: failure-domain.beta.kubernetes.io/zone | ||
values: | ||
- us-central1-a # 保留 PV 的一种方式 | ||
``` | ||
--- | ||
### 2.2 PersistentVolumeClaim | ||
```yaml | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: csi-cephfs-pvc | ||
namesapce: default | ||
spec: | ||
accessModes: | ||
- ReedWriteMany | ||
resorces: | ||
requests: | ||
storage: 2Gi | ||
volmeMode: Filesystem | ||
VolumeName: pvc-xxxxxx # 绑定 PV 自动填充 | ||
``` | ||
--- | ||
### 2.3 PersistentVolume | ||
```yaml | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
annotations: | ||
pv.kubernetes.io/provisioned-by: cephfs.csi.ceph.com | ||
finalizers: | ||
- kubernetes.io/pv-protection # 保护机制 | ||
spec: | ||
capcity: | ||
storage: 2Gi | ||
nodaAffinity: | ||
required: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- node01 # 分配到任何节点 | ||
``` | ||
--- | ||
## 3. CSI资源 | ||
### 3.1 CSIDriver | ||
```yaml | ||
apiVersion: storage.k8s.io/v1beta1 | ||
kind: CSIDriver | ||
metadata: | ||
name: rook-ceph.cephfs.csi.ceph.com | ||
spec: | ||
attchRequired: true | ||
podinfoOnMount: false | ||
volumeLifecycleModes: # 一个生命周期设置 | ||
- Persistent | ||
``` | ||
--- | ||
## 4. 各个 CSI 驱动能力列表 | ||
| 村储能力 | Ceph FS CSI | Ceph rbd CSI | | ||
| -------------- | ----------- | ------------ | | ||
| 支 持 | 支持 | 支持 | | ||
| 圈创建快照 | 支持 | 支持 | | ||
--- | ||
## 5. 测试资源 | ||
### 5.1 PersistentVolumeClaim | ||
```yaml | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: rbd-pvc | ||
spec: | ||
storageClasName: csi-rbd-sc | ||
reqests: | ||
storage: 1Gi | ||
volumeMode: Block # 一种模式 | ||
``` | ||
--- | ||
### 5.2 Deployment | ||
```yaml | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: csi-cephfs-demo-depl | ||
spec: | ||
replicas: 1 | ||
template: | ||
spec: | ||
containers: | ||
- name: web-server | ||
img: docker.io/library/nginx:latest | ||
command: ["/bin/sleep", "infinity"] # 写入工具 | ||
volumeMounts: | ||
- name: mypvc | ||
moutPath: /var/lib/www/html | ||
``` | ||
--- | ||
### 5.4 VolumeSnapshot | ||
```yaml | ||
apiVersion: snapshot.storage.k8s.io/v1beta1 | ||
kind: VolumeSnapshot | ||
metadata: | ||
name: cephfs-pvc-snapshot | ||
spec: | ||
volmeSnapshotClassName: csi-cephfsplugin-snapclass | ||
source: | ||
persistentVolumeClaimName: csi-cephfs-pvc # 恢复的某些快照 | ||
``` | ||
--- | ||
### 5.5 恢复 VolumeSnapshot | ||
```yaml | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: cephfs-pvc-restore | ||
spec: | ||
storageClassName: csi-cephfs-sc | ||
dataSource: | ||
name: cephfs-pvc-snapshot | ||
kind: VolumeSnapshot | ||
aipGroup: snapshot.storage.k8s.io | ||
accessModes: | ||
- ReadWriteMany | ||
resources: | ||
requests: | ||
storage: 2Gi | ||
``` | ||
--- | ||
## 6. 部署 | ||
### 6.1 NFS-CSI | ||
```text | ||
- 部署方式:`http://192.168.1.23:8890/Share/products/Kubernetes/CSI/nfs-csi` | ||
``` |