How to use STACKIT File Storage with Kubernetes Engine
Last updated on
This page demonstrates, how to connect a STACKIT File Storage (SFS) instance with SKE. This will allow you to use RWX volumes (ReadWriteMany) that can be attached to several Pods at once.
Prerequisites
Section titled “Prerequisites”- Your SKE cluster is part of an SNA project.
- Routing tables are enabled for that SNA.
- The STACKIT File Storage service is enabled for your region.
Installation
Section titled “Installation”-
Register the upstream Helm chart repository so Helm knows where to fetch the NFS Container Storage Interface (CSI) driver chart from. If you already have the repo configured, Helm will keep the existing entry and you can move on to the next step.
Terminal window helm repo add csi-driver-nfs https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts -
Create a file called
nfs-csi.yamlwith the following content. This is used to configure the CSI driver. Make sure to replace theserverandshareparameters with the actual information from your STACKIT File Storage setup and experiment with differentmountOptionsif necessary:storageClasses:- name: nfs-client <-- replace with your desired storageClass nameparameters:server: 10.10.0.1 <-- replace with your STACKIT File Storage server IPshare: /rp_Ew3Oak0/foo <-- replace with your STACKIT File Storage share pathreclaimPolicy: RetainvolumeBindingMode: ImmediatemountOptions:- nfsvers=4.1 <-- feel free to experiment with different options -
Deploy the configured CSI driver into your cluster. Using
helm upgradekeeps the command idempotent, so you can run it again later to apply updates. The--namespace kube-systemflag installs it into the system namespace. The-f nfs-csi.yamloption points to the configuration file you created in the previous step.Terminal window helm upgrade csi-driver-nfs csi-driver-nfs/csi-driver-nfs --namespace kube-system -f nfs-csi.yaml
After completing these steps, your cluster has the NFS CSI driver installed and is configured with a StorageClass that points to your STACKIT File Storage share. This means Kubernetes can now provision and mount RWX persistent volumes backed by that share, enabling multiple Pods to read from and write to the same storage.
To use the newly configured NFS share, simply reference the StorageClass you created earlier within, for example, a PersistentVolumeClaim:
apiVersion: v1kind: PersistentVolumeClaimmetadata: name: nfs-pvc-examplespec: storageClassName: nfs-client <-- replace with the name used for your StorageClass accessModes: - ReadWriteMany resources: requests: storage: 5GiThe PersistentVolumeClaim itself does not mount the volume into any Pod; it only reserves the storage.
This example also does not configure access controls, file permissions, or application-level data consistency for the mounted share. Depending on your use case, you may need to implement additional measures to ensure data integrity and security when multiple Pods are accessing the same NFS share.