Skip to content

feat(k8s): use of sfs with k8s #5296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions menu/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,10 @@
"label": "Recover ETCD database space for a cluster",
"slug": "recover-space-etcd"
},
{
"label": "How to use SFS with Kubernetes Kapsule",
"slug": "use-sfs-with-kubernetes"
},
{
"label": "Enable or disable SSH",
"slug": "enable-disable-ssh"
Expand Down
266 changes: 266 additions & 0 deletions pages/kubernetes/how-to/use-sfs-with-kubernetes.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
---
title: How to use SFS with Kubernetes Kapsule
description: This page explains how to use the Scaleway File Storage Container Storage Interface (CSI) driver to enable Kubernetes users to manage Scaleway File Storage volumes within their clusters.
tags: kubernetes kubernetes-kapsule kapsule sfs
dates:
validation: 2025-07-18
posted: 2025-07-18
categories:
- containers
- kubernetes
---
import Requirements from '@macros/iam/requirements.mdx'

The Scaleway File Storage Container Storage Interface (CSI) driver enables Kubernetes users to manage Scaleway File Storage file systems within their clusters.
The Scaleway File Storage CSI driver is designed to work with Kubernetes Kapsule and Kosmos clusters, providing a standardized interface to create, manage, and attach file storage volumes to your containerized workloads. For more details on Scaleway File Storage, refer to the [Scaleway File Storage documentation](https://www.scaleway.com/en/file-storage/).

## Supported features

The Scaleway File Storage CSI driver supports the following features:

- Dynamic provisioning: Automatically create Scaleway File Storage volumes using PVCs and StorageClasses.
- Import of existing Volumes: Integrate pre-existing Scaleway File Storage volumes into Kubernetes.
- Volume upsizing: The size of the volume can be [increased](https://github.com/scaleway/scaleway-filestorage-csi/tree/main?tab=readme-ov-file#file-systems-resizing) without the need to detach the file system
- `ReadWriteOnce` access mode: The volume can be mounted as read-write by a single node.
- `ReadOnlyMany` access mode: The volume can be mounted read-only by many nodes.
- `ReadWriteMany` access mode: The volume can be mounted as read-write by many nodes.

<Requirements />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
- [Created](/kubernetes/how-to/create-cluster/) a Kubernetes Kapsule cluster
- Access to the Scaleway File Storage API

## Installation

The Scaleway File Storage CSI driver is preinstalled on Scaleway's managed Kubernetes.

<Message type="note">
This feature is currently in [Private Beta](https://www.scaleway.com/en/betas/), and available to selected testers only.
</Message>

You can run the following command to check that the CSI driver pods are running:

```bash
kubectl get pods -n kube-system -l app=scaleway-filestorage-csi
```

You should see the `scaleway-filestorage-csi-controller` and `scaleway-filestorage-csi-node` pods in a `Running` state.

## Using the Scaleway File Storage CSI Driver

The CSI driver supports dynamic provisioning of Persistent Volumes (PVs) and Persistent Volume Claims (PVCs).

### Creating a Persistent Volume Claim (PVC)

1. Create a file named `pvc.yaml`:

```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100G
storageClassName: scw-fs
```

<Message type="note">
The minimum size for a File System is 100G.
</Message>

Apply it:

```bash
kubectl apply -f pvc.yaml
```

2. Create a file named `pod.yaml`:

```yaml
apiVersion: v1
kind: Pod
metadata:
name: my-app
spec:
containers:
- name: my-busybox
image: busybox
volumeMounts:
- name: my-volume
mountPath: "/data"
command: ["/bin/sh", "-c"]
args: ["tail -f /dev/null"]
volumes:
- name: my-volume
persistentVolumeClaim:
claimName: my-pvc
```

Apply the pod configuration:

```bash
kubectl apply -f pod.yaml
```

3. Verify the mount:

```bash
kubectl get pods
kubectl exec -it my-app -- df -h /data
```

### Importing an existing File Storage volume

1. Create a `pv-import.yaml` file:

```yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: test-pv
spec:
capacity:
storage: 100G
volumeMode: Filesystem
accessModes:
- ReadWriteMany
storageClassName: scw-fs
csi:
driver: filestorage.csi.scaleway.com
volumeHandle: fr-par/11111111-1111-1111-111111111111
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: topology.filestorage.csi.scaleway.com/region
operator: In
values:
- fr-par
```

Replace `volumeHandle` with the actual ID of your existing volume.

Apply:

```bash
kubectl apply -f pv-import.yaml
```

2. Create `pvc-import.yaml`:

```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-imported-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100G
storageClassName: scw-fs
volumeName: test-pv
```

Apply:

```bash
kubectl apply -f pvc-import.yaml
```

3. Create the pod (reuse the example from earlier with `claimName: my-imported-pvc`):

```yaml
apiVersion: v1
kind: Pod
metadata:
name: my-imported-app
spec:
containers:
- name: my-busybox
image: busybox
volumeMounts:
- name: my-volume
mountPath: "/data"
command: ["/bin/sh", "-c"]
args: ["tail -f /dev/null"]
volumes:
- name: my-volume
persistentVolumeClaim:
claimName: my-imported-pvc
```

Apply:

```bash
kubectl apply -f pod.yaml
```

4. Verify:

```bash
kubectl get pods
kubectl exec -it my-imported-app -- ls /data
```

### Using a custom storage class

1. Create `storageclass.yaml`:

```yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: my-default-storage-class
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: filestorage.csi.scaleway.com
reclaimPolicy: Delete
```

Apply:

```bash
kubectl apply -f storageclass.yaml
```

2. Update the PVC to use this storage class:

```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100G
storageClassName: my-default-storage-class
```

### Specifying the region

To specify a region explicitly for volume creation:

```yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: my-ams-storage-class
provisioner: filestorage.csi.scaleway.com
reclaimPolicy: Delete
allowedTopologies:
- matchLabelExpressions:
- key: topology.filestorage.csi.scaleway.com/region
values:
- nl-ams
```
Loading