Skip to content

Storage ​

So far, we have installed the cni and dns components to enable communication between pods. However, some applications require persistent storage.
To address this, there are two types of solutions: distributed storage and local storage.

Longhorn - Distributed storage ​

Longhorn is a cloud-native distributed block storage solution for Kubernetes. It provides persistent storage for Kubernetes workloads, allowing users to manage storage volumes with high availability, data replication, and automated backups.

dashboard

TIP

Longhorn is useful when you have a single pod replica that requires a persistent volume. By using Longhorn, the persistent volume will be replicated across Kubernetes nodes, ensuring high availability.

Installation ​

The installation of longhorn is quite simple. You can install it with this command:

bash
helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --version 1.7.2

Dashboard ​

To enable the access of dashboard, you need to add those values in values.yaml.

yaml
host: &host longhorn.yourdomain.com

longhorn:
  # enable ingress to access dashboard
  ingress:
    enabled: true
    ingressClassName: nginx
    tls: true
    tlsSecret: *host
    host: *host
    annotations:
      # We will see later how to manage TLS certificate with cert-manager and hashicorp vault
      cert-manager.io/cluster-issuer: vault-issuer
      cert-manager.io/common-name: *host

OpenEBS - Local storage ​

Sometimes, there are cases where distributed storage isn't necessary, and local storage suffices. For example, when deploying PostgreSQL in HA mode, you may not need Longhorn since the data is already replicated across pods in the HA setup.

OpenEBS is a Kubernetes native Container Native Storage solution that makes it possible for Stateful applications to easily access Dynamic Local PVs or Replicated PVs.

OpenEBS supports multiple storage backend like zfs or lvm. For my use case, the localpv-hostpath is enough.

Installation ​

The installation of OpenEBS requires the Helm chart located at https://openebs.github.io/openebs.

yaml
openebs:
  localpv-provisioner:
    localpv:
      # Specify the path on kubernetes nodes to store PV
      basePath: "/data"
    hostpathClass:
      reclaimPolicy: Retain

And voila !

Released under the MIT License.