|
| 1 | +# Local Path Provisioner |
| 2 | + |
| 3 | +[Local Path Provisioner](https://github.com/rancher/local-path-provisioner) provides a way for the Kubernetes users to |
| 4 | +utilize the local storage in each node. Based on the user configuration, the Local Path Provisioner will create |
| 5 | +`hostPath` based persistent volume on the node automatically. It utilizes the features introduced by Kubernetes [Local |
| 6 | +Persistent Volume feature](https://kubernetes.io/blog/2018/04/13/local-persistent-volumes-beta/), but make it a simpler |
| 7 | +solution than the built-in `local` volume feature in Kubernetes. |
| 8 | + |
| 9 | +## TL;DR; |
| 10 | + |
| 11 | +```console |
| 12 | +$ git clone https://github.com/rancher/local-path-provisioner.git |
| 13 | +$ cd local-path-provisioner |
| 14 | +$ helm install --name local-path-storage --namespace local-path-storage ./deploy/chart/ |
| 15 | +``` |
| 16 | + |
| 17 | +## Introduction |
| 18 | + |
| 19 | +This chart bootstraps a [Local Path Provisioner](https://github.com/rancher/local-path-provisioner) deployment on a |
| 20 | +[Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. |
| 21 | + |
| 22 | +## Prerequisites |
| 23 | + |
| 24 | +- Kubernetes 1.12+ with Beta APIs enabled |
| 25 | + |
| 26 | +## Installing the Chart |
| 27 | + |
| 28 | +To install the chart with the release name `local-path-storage`: |
| 29 | + |
| 30 | +```console |
| 31 | +$ git clone https://github.com/rancher/local-path-provisioner.git |
| 32 | +$ cd local-path-provisioner |
| 33 | +$ helm install ./deploy/chart/ --name local-path-storage --namespace local-path-storage |
| 34 | +``` |
| 35 | + |
| 36 | +The command deploys Local Path Provisioner on the Kubernetes cluster in the default configuration. The |
| 37 | +[configuration](#configuration) section lists the parameters that can be configured during installation. |
| 38 | + |
| 39 | +> **Tip**: List all releases using `helm list` |
| 40 | +
|
| 41 | +## Uninstalling the Chart |
| 42 | + |
| 43 | +To uninstall/delete the `local-path-storage` deployment: |
| 44 | + |
| 45 | +```console |
| 46 | +$ helm delete --purge local-path-storage |
| 47 | +``` |
| 48 | + |
| 49 | +The command removes all the Kubernetes components associated with the chart and deletes the release. |
| 50 | + |
| 51 | +## Configuration |
| 52 | + |
| 53 | +The following table lists the configurable parameters of the Local Path Provisioner for Kubernetes chart and their |
| 54 | +default values. |
| 55 | + |
| 56 | +| Parameter | Description | Default | |
| 57 | +| ----------------------------------- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | |
| 58 | +| `image.repository` | Local Path Provisioner image name | `rancher/local-path-provisioner` | |
| 59 | +| `image.tag` | Local Path Provisioner image tag | `master-head` | |
| 60 | +| `image.pullPolicy` | Image pull policy | `IfNotPresent` | |
| 61 | +| `storageClass.create` | If true, create a `StorageClass` | `true` | |
| 62 | +| `storageClass.provisionerName` | The provisioner name for the storage class | `nil` | |
| 63 | +| `storageClass.defaultClass` | If true, set the created `StorageClass` as the cluster's default `StorageClass` | `false` | |
| 64 | +| `storageClass.name` | The name to assign the created StorageClass | local-path | |
| 65 | +| `storageClass.reclaimPolicy` | ReclaimPolicy field of the class | Delete | |
| 66 | +| `nodePathMap` | Configuration of where to store the data on each node | `[{node: DEFAULT_PATH_FOR_NON_LISTED_NODES, paths: [/opt/local-path-provisioner]}]` | |
| 67 | +| `resources` | Local Path Provisioner resource requests & limits | `{}` | |
| 68 | +| `rbac.create` | If true, create & use RBAC resources | `true` | |
| 69 | +| `serviceAccount.create` | If true, create the Local Path Provisioner service account | `true` | |
| 70 | +| `serviceAccount.name` | Name of the Local Path Provisioner service account to use or create | `nil` | |
| 71 | +| `nodeSelector` | Node labels for Local Path Provisioner pod assignment | `{}` | |
| 72 | +| `tolerations` | Node taints to tolerate | `[]` | |
| 73 | +| `affinity` | Pod affinity | `{}` | |
| 74 | +| `configmap.setup` | Configuration of script to execute setup operations on each node | #!/bin/sh<br>while getopts "m:s:p:" opt<br>do<br> case $opt in <br>  p)<br>  absolutePath=$OPTARG<br>  ;;<br>  s)<br>  sizeInBytes=$OPTARG<br>  ;;<br>  m)<br>  volMode=$OPTARG<br>  ;;<br> esac<br>done<br>mkdir -m 0777 -p ${absolutePath} | |
| 75 | +| `configmap.teardown` | Configuration of script to execute teardown operations on each node | #!/bin/sh<br>while getopts "m:s:p:" opt<br>do<br> case $opt in <br>  p)<br>  absolutePath=$OPTARG<br>  ;;<br>  s)<br>  sizeInBytes=$OPTARG<br>  ;;<br>  m)<br>  volMode=$OPTARG<br>  ;;<br> esac<br>done<br>rm -rf ${absolutePath} | |
| 76 | +| `configmap.name` | configmap name | `local-path-config` | |
| 77 | +| `configmap.helperPod` | helper pod yaml file | apiVersion: v1<br>kind: Pod<br>metadata:<br> name: helper-pod<br>spec:<br> containers:<br> - name: helper-pod<br>  image: busybox | |
| 78 | + |
| 79 | + |
| 80 | +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, |
| 81 | + |
| 82 | +```console |
| 83 | +$ helm install ./deploy/chart/ --name local-path-storage --namespace local-path-storage --set storageClass.provisionerName=rancher.io/local-path |
| 84 | +``` |
| 85 | + |
| 86 | +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the |
| 87 | +chart. For example, |
| 88 | + |
| 89 | +```console |
| 90 | +$ helm install --name local-path-storage --namespace local-path-storage ./deploy/chart/ -f values.yaml |
| 91 | +``` |
| 92 | + |
| 93 | +> **Tip**: You can use the default [values.yaml](values.yaml) |
| 94 | +
|
| 95 | +## RBAC |
| 96 | + |
| 97 | +By default the chart will install the recommended RBAC roles and rolebindings. |
| 98 | + |
| 99 | +You need to have the flag `--authorization-mode=RBAC` on the api server. See the following document for how to enable |
| 100 | +[RBAC](https://kubernetes.io/docs/admin/authorization/rbac/). |
| 101 | + |
| 102 | +To determine if your cluster supports RBAC, run the following command: |
| 103 | + |
| 104 | +```console |
| 105 | +$ kubectl api-versions | grep rbac |
| 106 | +``` |
| 107 | + |
| 108 | +If the output contains "beta", you may install the chart with RBAC enabled (see below). |
| 109 | + |
| 110 | +### Enable RBAC role/rolebinding creation |
| 111 | + |
| 112 | +To enable the creation of RBAC resources (On clusters with RBAC). Do the following: |
| 113 | + |
| 114 | +```console |
| 115 | +$ helm install ./deploy/chart/ --name local-path-storage --namespace local-path-storage --set rbac.create=true |
| 116 | +``` |
0 commit comments