1. Xelon Docs
  2. Kubernetes Service

Persistent Storage in Xelon Kubernetes Service

We briefly explain how Persistent Storage works with Kubernetes Clusters in Xelon HQ.

By default, containers don't persist the data they produce. When a container is deleted, its data gets destroyed as well. Containerized applications that require data persistence need a storage backend that isn't destroyed when the application’s container terminates. That's why Xelon HQ allows you to create a Persistent Storage – a service that allows your data to be stored outside the pods.


Add Persistent Storage to your Cluster

Within the Persistent Storage page, click the green Create Persistent Storage button. You'll see a wizard opened, where you should specify the Persistent Storage's name, its volume (from 5 to 1000 GBs), and attach it to an organization and its device.

persistent storage.png

When all set, click Deploy Persistent Storage.

deploy PS button.png

It will appear in the list of all Persistent Storages – there you can extend its volume, reattach to another device, or delete.

How to use NFS in Kubernetes

Prerequisites:

  • A running Kubernetes cluster; we suggest using v1.18 or higher.
  • A running node with some available storage.

Deploy and configure the NFS server


Run the following commands on your NFS server node:

apt update && apt -y upgradeapt install -y nfs-servermkdir /datacat << EOF >> /etc/exports
/data 192.168.12.0/24(rw,no_subtree_check,no_root_squash)
EOFsystemctl enable --now nfs-serverexportfs -ar

You can also deploy the NFS server in a clustered way with high availability support.

​Dynamic provisioning using StorageClass

To provision Persistent Storage dynamically using the StorageClass, you need to install the NFS provisioner. We'll use the nfs-subdir-external-provisioner to for that purpose. The following commands install all things we need by using the Helm package manage:

helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisionerhelm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \
--create-namespace \
--namespace nfs-provisioner \
--set nfs.server=IP_OFF_THE_NFS_NODE \
--set nfs.path=/data

Kubernetes with the NFS StorageClass

​To create the PersistentVolumeClaim, use the following manifest:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nfs-test
labels:
storage.k8s.io/name: nfs
storage.k8s.io/created-by: mstoeckle
spec:
accessModes:
- ReadWriteMany
storageClassName: nfs-client
resources:
requests:
storage: 1Gi

Kubernetes and NFS storage specification

​The NFS has the following specifications in that you need to consider them before using the NFS storage:

  • ReadWriteOnce, ReadOnlyMany, ReadWriteMany access modes.
  • The storage size does not take any effect.
  • In the case of dynamic provisioning, volumes are separated into different directories (but without any access controls).