storage

by stakater

Helm chartv1.0.7App 1.0.0Verified publisher

Chart that deploys PV and PVC for use with any application

About this chart

storage

This chart is used to apply pv and pvc. You can specify any number of pv and pvc. This chart can come in handy when a public chart does not offer additional pv and pvc. You have to use the following format to specify pv and pvc:

Volumes:
- name: storage-volume
  annotations: {}
  labels:
    app: appname
  accessModes:
  - ReadWriteOnce
  storage: 10Gi
  nfs:
    server: fs-blabla.efs.eu-west-1.amazonaws.com
    path: /home/storage

Claims:
- name: storage-volume-claim
  annotations: {}
  storageClassName: efs
  storage: 10Gi
  volumeName: storage-volume
  labels:
    app: appname
  accessModes:
  - ReadWriteOnce

For installing the chart, run the following command:

helm repo add stable https://kubernetes-charts.storage.googleapis.com/

helm repo update

helm install stable/storages -f values.yaml --namespace <namespace-name>

Usage

The following quickstart let's you set up secret:

  1. Update the values.yaml and set the following properties
KeyDescriptionExampleDefault Value
Volumes.namename of the volumeteststorage-volume
Volumes.annotationsannotations for volume``{}
Volumes.accessModesaccessModes of the volumeReadWriteOnceReadWriteOnce
Volumes.labelslabel for volumeapp: app-nameapp: app-name
Volumes.storagestorage size for volume8Gi8Gi
Volumes.claimRef.nameName of claim referencestorage-data``
Volumes.nfs.serverserver for volumefs-blabla.efs.eu-west-1.amazonaws.comfs-blabla.efs.eu-west-1.amazonaws.com
Volumes.nfs.pathpath for volume/home/storage/home/storage
Claims.namename of the claimstorage-volume-claimstorage-volume-claim
Claims.annotationsannotations for claim``{}
Claims.accessModesaccessModes of the claimReadWriteOnceReadWriteOnce
Claims.labelslabel for claimapp: app-nameapp: app-name
Claims.storagestorage size for claim8Gi8Gi
Claims.storageClassNamestorageClass name for claimefsefs
Claims.volumeNamevolume name for claimstorage-volumestorage-volume

Example

Storage chart is used to create persistent volumes and persistent volume claims for other charts which does not support creation of additional volumes and claims. For example, we need additional storage for jenkins chart but there is no support for creation of additional PV and PVCs. Below are the steps, that explain how to achieve this using storage chart.

  • Update the values.yaml file to create a persistent volume claim.
Claims:
- name: jenkins-mvn-local-repo
  annotations:
    volume.beta.kubernetes.io/storage-class: efs
    helm.sh/resource-policy: keep
  storage: 8Gi
  # if you speicify storageClassName then volumeName is ignored and claim is made with storageClass instead of volume
  storageClassName: "efs"
  # volumeName: storage-volume
  labels:
    app: jenkins
  accessModes:
  - ReadWriteOnce
  • Deploy the storage chart. This will create a persistent volume claim with name jenkins-mvn-local-repo having 8Gi of storage.
  • Now, to mount this PVC in jenkins, update the values.yaml in jenkins chart. We need to update the volumes and mounts under Persistence
  volumes:
  - name: jenkins-mvn-local-repo
    persistentVolumeClaim:
      claimName: jenkins-mvn-local-repo
  mounts:
  - mountPath: /mvn-data
    name: jenkins-mvn-local-repo
  • Deploy the jenkins chart and we can see the additional PVC jenkins-mvn-local-repo mounted on path /mvn-data.

Deploy storage with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has storage 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 chartstorage is pinned at v1.0.7 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