From ccd0ad773e630de01abfcd46f582766c292b79e8 Mon Sep 17 00:00:00 2001 From: Aylei Date: Wed, 10 Apr 2019 19:15:09 +0800 Subject: [PATCH 1/4] Update local-pv documentation Signed-off-by: Aylei --- docs/setup.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/setup.md b/docs/setup.md index 1dc33b4c742..3cac6bb2828 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -91,13 +91,22 @@ Use this command to confirm the mount point exist: $ mount | grep /mnt/disks/local-pv01 ``` -To auto-mount disks when your operating system is booted, you should edit `/etc/fstab` to include these mounting info: +### Auto-mount on reboot +To auto-mount disks when your operating system is booted, you should edit `/etc/fstab` to include these mounting info. + +Disk mount: +```shell +$ echo "/dev/nvme0n1 /mnt/disks/disk01 ext4 defaults 0 0" >> /etc/fstab +``` + +Bind mount: ```shell -$ echo "/dev/nvme0n1 /mnt/disks/disk0 none bind 0 0" >> /etc/fstab $ echo "/data/local-pv01 /mnt/disks/local-pv01 none bind 0 0" >> /etc/fstab ``` +### Deploy local-static-provisioner + After mounting all data disks on Kubernetes nodes, you can deploy [local-volume-provisioner](https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner) to automatically provision the mounted disks as Local PersistentVolumes. ```shell @@ -106,6 +115,8 @@ $ kubectl get po -n kube-system -l app=local-volume-provisioner $ kubectl get pv | grep local-storage ``` +> Note: The local-volume plugin expects paths to be stable, if you remove a previous mount-point in the discovery directory (default to `/mnt/disks/`), you should remove the PV manually to keep consistency. + ## Install TiDB Operator TiDB Operator uses [CRD](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/) to extend Kubernetes, so to use TiDB Operator, you should first create `TidbCluster` custom resource kind. This is a one-time job, namely you can only need to do this once in your Kubernetes cluster. From 2b43106f6f365b1c0f2782ced7cde5f4ff132968 Mon Sep 17 00:00:00 2001 From: Aylei Date: Thu, 11 Apr 2019 13:33:51 +0800 Subject: [PATCH 2/4] Resolve comments Signed-off-by: Aylei --- docs/setup.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/setup.md b/docs/setup.md index 3cac6bb2828..8f74bf8ca43 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -115,6 +115,16 @@ $ kubectl get po -n kube-system -l app=local-volume-provisioner $ kubectl get pv | grep local-storage ``` +### Remove a mount point + +If we want to remove a mount point, first we need to `umount` the mount point, and then delete the related directories. For example: + +```shell +$ umount /mnt/disks/local-pv01 +$ rm -rf /mnt/disks/local-pv01 +$ rm -rf /data/local-pv01 +``` + > Note: The local-volume plugin expects paths to be stable, if you remove a previous mount-point in the discovery directory (default to `/mnt/disks/`), you should remove the PV manually to keep consistency. ## Install TiDB Operator From f6bebafc9a54d35a66b547567af4063ad49762e0 Mon Sep 17 00:00:00 2001 From: Aylei Date: Tue, 16 Apr 2019 16:19:20 +0800 Subject: [PATCH 3/4] Address review comments Signed-off-by: Aylei --- charts/tidb-cluster/templates/tidb-service.yaml | 2 +- docs/setup.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/charts/tidb-cluster/templates/tidb-service.yaml b/charts/tidb-cluster/templates/tidb-service.yaml index 8467b423832..1246279c838 100644 --- a/charts/tidb-cluster/templates/tidb-service.yaml +++ b/charts/tidb-cluster/templates/tidb-service.yaml @@ -18,7 +18,7 @@ spec: externalTrafficPolicy: {{ .Values.tidb.service.externalTrafficPolicy }} {{- end }} {{- if .Values.tidb.service.loadBalancerIP }} - loadBalancerIP: {{ .Values.tidb.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.tidb.service.loadBalancerIP } {{- end }} ports: - name: mysql-client diff --git a/docs/setup.md b/docs/setup.md index 8f74bf8ca43..564538cb0bb 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -125,6 +125,8 @@ $ rm -rf /mnt/disks/local-pv01 $ rm -rf /data/local-pv01 ``` +You should also delete the related entries in `/etc/fstab` at the same time, otherwise the automount may cause problems when the machine restarts. + > Note: The local-volume plugin expects paths to be stable, if you remove a previous mount-point in the discovery directory (default to `/mnt/disks/`), you should remove the PV manually to keep consistency. ## Install TiDB Operator From 2922ec129ef8abc57a51e067b659e6e0d7f8fb9b Mon Sep 17 00:00:00 2001 From: Aylei Date: Tue, 16 Apr 2019 16:20:36 +0800 Subject: [PATCH 4/4] Fix typo Signed-off-by: Aylei --- charts/tidb-cluster/templates/tidb-service.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tidb-cluster/templates/tidb-service.yaml b/charts/tidb-cluster/templates/tidb-service.yaml index 1246279c838..8467b423832 100644 --- a/charts/tidb-cluster/templates/tidb-service.yaml +++ b/charts/tidb-cluster/templates/tidb-service.yaml @@ -18,7 +18,7 @@ spec: externalTrafficPolicy: {{ .Values.tidb.service.externalTrafficPolicy }} {{- end }} {{- if .Values.tidb.service.loadBalancerIP }} - loadBalancerIP: {{ .Values.tidb.service.loadBalancerIP } + loadBalancerIP: {{ .Values.tidb.service.loadBalancerIP }} {{- end }} ports: - name: mysql-client