| Giorgi Lekveishvili | 4ec4c02 | 2024-08-17 15:09:24 +0400 | [diff] [blame] | 1 | # Installing a NFS-provisioner |
| 2 | |
| 3 | The Gerrit replica requires access to a persistent volume capable of running in |
| 4 | `Read Write Many (RWM)`-mode to store the git repositories, since the repositories |
| 5 | have to be accessed by mutiple pods. One possibility to provide such volumes |
| 6 | is to install a provisioner for NFS-volumes into the same Kubernetes-cluster. |
| 7 | This document will guide through the process. |
| 8 | |
| 9 | The [Kubernetes external-storage project](https://github.com/kubernetes-incubator/external-storage) |
| 10 | provides an out-of-tree dynamic [provisioner](https://github.com/kubernetes-incubator/external-storage/tree/master/nfs) |
| 11 | for NFS volumes. A chart exists for easy deployment of the project onto a |
| 12 | Kubernetes cluster. The chart's sources can be found [here](https://github.com/helm/charts/tree/master/stable/nfs-server-provisioner). |
| 13 | |
| 14 | ## Prerequisites |
| 15 | |
| 16 | This guide will use Helm to install the NFS-provisioner. Thus, Helm has to be |
| 17 | installed. |
| 18 | |
| 19 | ## Installing the nfs-server-provisioner chart |
| 20 | |
| 21 | A custom `values.yaml`-file containing a configuration tested with the |
| 22 | gerrit-replica chart can be found in the `supplements/nfs`-directory in the |
| 23 | gerrit-replica chart's root directory. In addition a file stating the tested |
| 24 | version of the nfs-server-provisioner chart is present in the same directory. |
| 25 | |
| 26 | If needed, adapt the `values.yaml`-file for the nfs-server-provisioner chart |
| 27 | further and then run: |
| 28 | |
| 29 | ```sh |
| 30 | cd $(git rev-parse --show-toplevel)/helm-charts/gerrit-replica/supplements/nfs |
| 31 | helm install nfs \ |
| 32 | stable/nfs-server-provisioner \ |
| 33 | -f values.yaml \ |
| 34 | --version $(cat VERSION) |
| 35 | ``` |
| 36 | |
| 37 | For a description of the configuration options, refer to the |
| 38 | [chart's documentation](https://github.com/helm/charts/blob/master/stable/nfs-server-provisioner/README.md). |
| 39 | |
| 40 | Here are some tips for configuring the nfs-server-provisioner chart to work with |
| 41 | the gerrit-replica chart: |
| 42 | |
| 43 | - Deploying more than 1 `replica` led to some reliability issues in tests and |
| 44 | should be further tested for now, if required. |
| 45 | - The name of the StorageClass created for NFS-volumes has to be the same as the |
| 46 | one defined in the gerrit-replica chart for `storageClasses.shared.name` |
| 47 | - The StorageClas for NFS-volumes needs to have the parameter `mountOptions: vers=4.1`, |
| 48 | due to compatibility [issues](https://github.com/kubernetes-incubator/external-storage/issues/223) |
| 49 | with Ganesha. |
| 50 | |
| 51 | ## Deleting the nfs-server-provisioner chart |
| 52 | |
| 53 | ***note |
| 54 | **Attention:** Never delete the nfs-server-provisioner chart, if there is still a |
| 55 | PersistentVolumeClaim and Pods using a NFS-volume provisioned by the NFS server |
| 56 | provisioner. This will lead to crashed pods, that will not be terminated correctly. |
| 57 | *** |
| 58 | |
| 59 | If no Pod or PVC is using a NFS-volume provisioned by the NFS server provisioner |
| 60 | anymore, delete it like any other chart: |
| 61 | |
| 62 | ```sh |
| 63 | helm delete nfs |
| 64 | ``` |