Skip to content

Commit

Permalink
Merge pull request hwameistor#130 from alexzhc/main
Browse files Browse the repository at this point in the history
[doc] update "configure storage pool"
  • Loading branch information
SSmallMonster authored Aug 8, 2022
2 parents 1a69dc5 + f367daf commit d959e39
Show file tree
Hide file tree
Showing 27 changed files with 1,007 additions and 42 deletions.
17 changes: 3 additions & 14 deletions docs/docs/01.installation/02.post-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,7 @@ hwameistor-webhook-986479678-278cr 1/1 Running
`local-disk-manager` and `local-storage` are `DaemonSets`. They should have one pod on each Kubernetes node.
:::


## Step 2: Check the storageclass

A `storageClass` should be created:

```bash
$ kubectl get storageclass hwameistor-storage-disk-hdd
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
hwameistor-storage-disk-hdd disk.hwameistor.io Delete WaitForFirstConsumer true 4m29s
```

## Step 3: Check the APIs
## Step 2: Check the APIs

HwameiStor CRDs create the following APIs.

Expand All @@ -74,9 +63,9 @@ localvolumereplicas lvr hwameistor.io/v1alpha1 false Lo
localvolumes lv hwameistor.io/v1alpha1 false LocalVolume
```

For the details about CRDs, please also refer to the chapter [CRDs](../04.components/00.crd.md).
For the details about CRDs, please also refer to the chapter [CRDs](../04.modules/00.crd.md).

# Step 4: Check the localDiskNode and localDisks
# Step 3: Check the localDiskNode and localDisks

HwameiStor autoscans each node and registers each disk as CRD `localDisk(ld)`. The unused disks are displayed with `PHASE: Unclaimed`.

Expand Down
98 changes: 98 additions & 0 deletions docs/docs/01.installation/03.config-pool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
sidebar_position: 4
sidebar_label: "Configure Storage Pool"
---

# Configure Storage Pool

## Step 1: Create LocalDiskClaim objects

HwameiStor sets up storage pools by creating `LocalDiskClaim` objects according to the storage media types. To create an HDD pool on all kubernetes worker nodes:

```bash
$ helm template helm/hwameistor \
-s templates/post-install-claim-disks.yaml \
--set storageNodes='{k8s-worker-1,k8s-worker-2,k8s-worker-3}' \
| kubectl apply -f -
```

## Step 2: Verify LocalDiskClaim objects

```bash
$ kubectl get ldc
NAME NODEMATCH PHASE
k8s-worker-1 k8s-worker-1 Bound
k8s-worker-2 k8s-worker-2 Bound
k8s-worker-3 k8s-worker-3 Bound
```

## Step 3: Verify StorageClass

```bash
$ kubectl get sc hwameistor-storage-lvm-hdd
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
hwameistor-storage-lvm-hdd lvm.hwameistor.io Delete WaitForFirstConsumer true 114s
```

## Step 4: Verify LocalDisk objects

```bash
$ kubectl get ld
NAME NODEMATCH CLAIM PHASE
k8s-worker-1-sda k8s-worker-1 Inuse
k8s-worker-1-sdb k8s-worker-1 k8s-worker-1 Claimed
k8s-worker-1-sdc k8s-worker-1 k8s-worker-1 Claimed
k8s-worker-1-sdd k8s-worker-1 Inuse
k8s-worker-1-sde k8s-worker-1 Inuse
k8s-worker-2-sda k8s-worker-2 Inuse
k8s-worker-2-sdb k8s-worker-2 k8s-worker-2 Claimed
k8s-worker-2-sdc k8s-worker-2 k8s-worker-2 Claimed
k8s-worker-2-sdd k8s-worker-2 Inuse
k8s-worker-2-sde k8s-worker-2 Inuse
k8s-worker-3-sda k8s-worker-3 Inuse
k8s-worker-3-sdb k8s-worker-3 k8s-worker-3 Claimed
k8s-worker-3-sdc k8s-worker-3 k8s-worker-3 Claimed
k8s-worker-3-sdd k8s-worker-3 Inuse
k8s-worker-3-sde k8s-worker-3 Inuse
```

## Step 5 (Optional): Observe VG

On a kubernetes worker node, observe a `VG` is created for an `LocalDiskClaim` object

```bash
root@k8s-worker-1:~$ vgdisplay LocalStorage_PoolHDD
--- Volume group ---
VG Name LocalStorage_PoolHDD
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 199.99 GiB
PE Size 4.00 MiB
Total PE 51198
Alloc PE / Size 0 / 0
Free PE / Size 51198 / 199.99 GiB
VG UUID jJ3s7g-iyoJ-c4zr-3Avc-3K4K-BrJb-A5A5Oe
```

## Set up storage pool during deployment

A storage pool can be configured during HwameiStor deployment by helm command:

```bash
$ helm install \
--namespace hwameistor \
--create-namespace \
hwameistor \
helm/hwameistor \
--set storageNodes='{k8s-worker-1,k8s-worker-2,k8s-worker-3}'
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 4
sidebar_position: 5
sidebar_label: "Upgrade"
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 5
sidebar_position: 6
sidebar_label: "Uninstall"
---

Expand Down Expand Up @@ -33,10 +33,18 @@ $ kubectl get crd -o name \
| xargs -t kubectl delete
```

### Remove clusterroles and rolebindings
### Remove clusterRoles and roleBindings

```bash
$ kubectl get clusterrolebinding,clusterrole -o name \
| grep hwameistor \
| xargs -t kubectl delete
```
```

### Remove storageClass

```bash
$ kubectl get sc -o name \
| grep hwameistor-storage-lvm- \
| xargs -t kubectl delete
```
4 changes: 0 additions & 4 deletions docs/docs/04.components/_category_.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions docs/docs/04.modules/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Modules",
"position": 5
}
6 changes: 3 additions & 3 deletions docs/i18n/cn/docusaurus-plugin-content-docs/current.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"message": "后端操作",
"description": "The label for category Backend Operations in sidebar tutorialSidebar"
},
"sidebar.tutorialSidebar.category.Components": {
"message": "组件",
"description": "The label for category Components in sidebar tutorialSidebar"
"sidebar.tutorialSidebar.category.Modules": {
"message": "模块",
"description": "The label for category modules in sidebar tutorialSidebar"
},
"sidebar.tutorialSidebar.category.Applications": {
"message": "应用",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ localvolumereplicas lvr hwameistor.io/v1alpha1 false Lo
localvolumes lv hwameistor.io/v1alpha1 false LocalVolume
```

For the details about CRDs, please also refer to the chapter [CRDs](../04.components/00.crd.md).
For the details about CRDs, please also refer to the chapter [CRDs](../04.modules/00.crd.md).

# Step 4: Check the localDiskNode and localDisks

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
sidebar_position: 4
sidebar_label: "配置存储池"
---

# Configure Storage Pool

## Step 1: Create LocalDiskClaim objects

HwameiStor sets up storage pools by creating `LocalDiskClaim` objects according to the storage media types. To create an HDD pool on all kubernetes worker nodes:

```bash
$ helm template helm/hwameistor \
-s templates/post-install-claim-disks.yaml \
--set storageNodes='{k8s-worker-1,k8s-worker-2,k8s-worker-3}' \
| kubectl apply -f -
```

## Step 2: Verify LocalDiskClaim objects

```bash
$ kubectl get ldc
NAME NODEMATCH PHASE
k8s-worker-1 k8s-worker-1 Bound
k8s-worker-2 k8s-worker-2 Bound
k8s-worker-3 k8s-worker-3 Bound
```

## Step 3: Verify StorageClass

```bash
$ kubectl get sc hwameistor-storage-lvm-hdd
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
hwameistor-storage-lvm-hdd lvm.hwameistor.io Delete WaitForFirstConsumer true 114s
```

## Step 4: Verify LocalDisk objects

```bash
$ kubectl get ld
NAME NODEMATCH CLAIM PHASE
k8s-worker-1-sda k8s-worker-1 Inuse
k8s-worker-1-sdb k8s-worker-1 k8s-worker-1 Claimed
k8s-worker-1-sdc k8s-worker-1 k8s-worker-1 Claimed
k8s-worker-1-sdd k8s-worker-1 Inuse
k8s-worker-1-sde k8s-worker-1 Inuse
k8s-worker-2-sda k8s-worker-2 Inuse
k8s-worker-2-sdb k8s-worker-2 k8s-worker-2 Claimed
k8s-worker-2-sdc k8s-worker-2 k8s-worker-2 Claimed
k8s-worker-2-sdd k8s-worker-2 Inuse
k8s-worker-2-sde k8s-worker-2 Inuse
k8s-worker-3-sda k8s-worker-3 Inuse
k8s-worker-3-sdb k8s-worker-3 k8s-worker-3 Claimed
k8s-worker-3-sdc k8s-worker-3 k8s-worker-3 Claimed
k8s-worker-3-sdd k8s-worker-3 Inuse
k8s-worker-3-sde k8s-worker-3 Inuse
```

## Step 5 (Optional): Observe VG

On a kubernetes worker node, observe a `VG` is created for an `LocalDiskClaim` object

```bash
root@k8s-worker-1:~$ vgdisplay LocalStorage_PoolHDD
--- Volume group ---
VG Name LocalStorage_PoolHDD
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 199.99 GiB
PE Size 4.00 MiB
Total PE 51198
Alloc PE / Size 0 / 0
Free PE / Size 51198 / 199.99 GiB
VG UUID jJ3s7g-iyoJ-c4zr-3Avc-3K4K-BrJb-A5A5Oe
```

## Configure storage pool during deployment

A storage pool can be configured during HwameiStor deployment by helm command:

```bash
$ helm install \
--namespace hwameistor \
--create-namespace \
hwameistor \
helm/hwameistor \
--set storageNodes='{k8s-worker-1,k8s-worker-2,k8s-worker-3}'
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 4
sidebar_position: 5
sidebar_label: "升级"
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 5
sidebar_position: 6
sidebar_label: "卸载"
---

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "模块",
"position": 5
}
2 changes: 1 addition & 1 deletion helm/hwameistor/templates/post-install-claim-disks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ spec:
# The field value should be consistent with the nodeName in localdisk
nodeName: {{ . }}
description:
diskType: {{ $.Values.storageclass.diskType }}
diskType: {{ $.Values.storageClass.diskType }}
---
{{- end}}
16 changes: 8 additions & 8 deletions helm/hwameistor/templates/storageclass.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{{- if .Values.storageclass.enabled -}}
{{- if .Values.storageClass.enabled -}}
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
annotations:
storageclass.kubernetes.io/is-default-class: {{ .Values.storageclass.default | quote }}
name: hwameistor-storage-lvm-{{ .Values.storageclass.diskType | lower}}
storageClass.kubernetes.io/is-default-class: {{ .Values.storageClass.default | quote }}
name: hwameistor-storage-lvm-{{ .Values.storageClass.diskType | lower}}
provisioner: lvm.hwameistor.io
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: {{ .Values.storageclass.allowVolumeExpansion }}
reclaimPolicy: {{ .Values.storageclass.reclaimPolicy }}
allowVolumeExpansion: {{ .Values.storageClass.allowVolumeExpansion }}
reclaimPolicy: {{ .Values.storageClass.reclaimPolicy }}
parameters:
replicaNumber: {{ .Values.storageclass.replicaNumber | quote}}
poolClass: {{ .Values.storageclass.diskType | quote}}
replicaNumber: {{ .Values.storageClass.replicaNumber | quote}}
poolClass: {{ .Values.storageClass.diskType | quote}}
poolType: "REGULAR"
volumeKind: "LVM"
striped: "true"
csi.storage.k8s.io/fstype: {{ .Values.storageclass.fsType | quote}}
csi.storage.k8s.io/fstype: {{ .Values.storageClass.fsType | quote}}
{{- end }}
2 changes: 1 addition & 1 deletion helm/hwameistor/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ hwameistorImageRegistry: ghcr.io
kubeletRootDir: /var/lib/kubelet

# StorageClass Settings
storageclass:
storageClass:
# If enabled, a hwameistor storageclass will be created in your system
enabled: true
# If enabled, hwameistor storageclass will be a default storageclass in system
Expand Down
Loading

0 comments on commit d959e39

Please sign in to comment.