local-path-provisioner

by mikejoh

Helm chartv0.0.29App v0.0.29Verified publisher

Use HostPath for persistent local storage with Kubernetes

About this chart

Local Path Provisioner

Local Path Provisioner provides a way for the Kubernetes users to utilize the local storage in each node. Based on the user configuration, the Local Path Provisioner will create hostPath based persistent volume on the node automatically. It utilizes the features introduced by Kubernetes Local Persistent Volume feature, but make it a simpler solution than the built-in local volume feature in Kubernetes.

TL;DR;

$ git clone https://github.com/rancher/local-path-provisioner.git
$ cd local-path-provisioner
$ helm install --name local-path-storage --namespace local-path-storage ./deploy/chart/local-path-provisioner

Introduction

This chart bootstraps a Local Path Provisioner deployment on a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes 1.12+ with Beta APIs enabled

Installing the Chart

To install the chart with the release name local-path-storage:

$ git clone https://github.com/rancher/local-path-provisioner.git
$ cd local-path-provisioner
$ helm install ./deploy/chart/local-path-provisioner --name local-path-storage --namespace local-path-storage

The command deploys Local Path Provisioner on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the local-path-storage deployment:

$ helm uninstall local-path-storage

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the Local Path Provisioner for Kubernetes chart and their default values.

ParameterDescriptionDefault
commonLabelsCustom labels to apply to all resources{}
image.repositoryLocal Path Provisioner image namerancher/local-path-provisioner
image.tagLocal Path Provisioner image tagv0.0.29 .
image.pullPolicyImage pull policyIfNotPresent
storageClass.createIf true, create a StorageClasstrue
storageClass.provisionerNameThe provisioner name for the storage classnil
storageClass.defaultClassIf true, set the created StorageClass as the cluster's default StorageClassfalse
storageClass.defaultVolumeTypeThe default volume type this storage class createshostPath
storageClass.nameThe name to assign the created StorageClasslocal-path
storageClass.reclaimPolicyReclaimPolicy field of the classDelete
storageClass.pathPatternTemplate for the volume directory namenil
nodePathMapConfiguration of where to store the data on each node[{node: DEFAULT_PATH_FOR_NON_LISTED_NODES, paths: [/opt/local-path-provisioner]}]
resourcesLocal Path Provisioner resource requests & limits{}
rbac.createIf true, create & use RBAC resourcestrue
serviceAccount.createIf true, create the Local Path Provisioner service accounttrue
serviceAccount.nameName of the Local Path Provisioner service account to use or createnil
nodeSelectorNode labels for Local Path Provisioner pod assignment{}
tolerationsNode taints to tolerate[]
affinityPod affinity{}
configmap.setupConfiguration of script to execute setup operations on each node#!/bin/shwhile getopts "m:s:p:" optdo case $opt in   p)  absolutePath=$OPTARG  ;;  s)  sizeInBytes=$OPTARG  ;;  m)  volMode=$OPTARG  ;; esacdonemkdir -m 0777 -p ${absolutePath}
configmap.teardownConfiguration of script to execute teardown operations on each node#!/bin/shwhile getopts "m:s:p:" optdo case $opt in   p)  absolutePath=$OPTARG  ;;  s)  sizeInBytes=$OPTARG  ;;  m)  volMode=$OPTARG  ;; esacdonerm -rf ${absolutePath}
configmap.nameconfigmap namelocal-path-config
configmap.helperPodhelper pod yaml fileapiVersion: v1kind: Podmetadata: name: helper-podspec: containers: - name: helper-pod  image: busybox

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,

$ helm install ./deploy/chart/local-path-provisioner --name local-path-storage --namespace local-path-storage --set storageClass.provisionerName=rancher.io/local-path

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,

$ helm install --name local-path-storage --namespace local-path-storage ./deploy/chart/local-path-provisioner -f values.yaml

Tip: You can use the default values.yaml

RBAC

By default the chart will install the recommended RBAC roles and rolebindings.

You need to have the flag --authorization-mode=RBAC on the api server. See the following document for how to enable RBAC.

To determine if your cluster supports RBAC, run the following command:

$ kubectl api-versions | grep rbac

If the output contains "beta", you may install the chart with RBAC enabled (see below).

Enable RBAC role/rolebinding creation

To enable the creation of RBAC resources (On clusters with RBAC). Do the following:

$ helm install ./deploy/chart/local-path-provisioner --name local-path-storage --namespace local-path-storage --set rbac.create=true

Deploy local-path-provisioner with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has local-path-provisioner on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartlocal-path-provisioner is pinned at v0.0.29 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply