Skip to content

Commit 21345ad

Browse files
bene2k1RoRoJTomy2e
authored
feat(k8s): use of sfs with k8s (#5296)
* feat(k8s): update sfs * feat(k8s): update sfs * feat(k8s): sfs * feat(k8s): use sfs * feat(k8s): sfs * feat(k8s): update content * Update pages/kubernetes/how-to/use-sfs-with-kubernetes.mdx * Apply suggestions from code review Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> * Apply suggestions from code review * feat(k8s): update sfs * Apply suggestions from code review Co-authored-by: Tomy Guichard <tomy2e@live.fr> * Update pages/kubernetes/how-to/use-sfs-with-kubernetes.mdx Co-authored-by: Tomy Guichard <tomy2e@live.fr> * docs(k8s): update content * Apply suggestions from code review * Apply suggestions from code review * docs(k8s): update warning --------- Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> Co-authored-by: Tomy Guichard <tomy2e@live.fr>
1 parent b373f55 commit 21345ad

File tree

2 files changed

+288
-0
lines changed

2 files changed

+288
-0
lines changed
Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
---
2+
title: How to use SFS with Kubernetes Kapsule
3+
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.
4+
tags: kubernetes kubernetes-kapsule kapsule sfs
5+
dates:
6+
validation: 2025-10-22
7+
posted: 2025-10-22
8+
categories:
9+
- containers
10+
- kubernetes
11+
---
12+
import Requirements from '@macros/iam/requirements.mdx'
13+
14+
The Scaleway File Storage Container Storage Interface (CSI) driver enables Kubernetes users to manage Scaleway File Storage file systems within their clusters.
15+
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/docs/file-storage/).
16+
17+
## Supported features
18+
19+
The Scaleway File Storage CSI driver supports the following features:
20+
21+
- Dynamic provisioning: Automatically create Scaleway File Storage volumes using PVCs and StorageClasses.
22+
- Import of existing Volumes: Integrate pre-existing Scaleway File Storage volumes into Kubernetes.
23+
- 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
24+
- `ReadWriteOnce` access mode: The volume can be mounted as read-write by a single node.
25+
- `ReadOnlyMany` access mode: The volume can be mounted read-only by many nodes.
26+
- `ReadWriteMany` access mode: The volume can be mounted as read-write by many nodes.
27+
28+
<Message type="important">
29+
Ensure you have created your Kapsule cluster with the tag `scw-filestorage-csi` (or added it to an existing cluster) to have the File Storage CSI driver enabled on your cluster.
30+
Keep in mind, this tag must be specified at the **cluster level** rather than at the pool level. Setting it at the pool level has no effect.
31+
</Message>
32+
33+
<Requirements />
34+
35+
- A Scaleway account logged into the [console](https://console.scaleway.com)
36+
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
37+
- [Created](/kubernetes/how-to/create-cluster/) a Kubernetes Kapsule cluster
38+
- Installed the Kubernetes command-line tool `kubectl`
39+
- Added the tag `scw-filestorage-csi` to your Kubernetes Kapsule cluster
40+
- Access to the Scaleway [File Storage API](https://www.scaleway.com/en/developers/api/file-storage/)
41+
42+
## Installation
43+
44+
The Scaleway File Storage CSI driver is preinstalled on Scaleway's managed Kubernetes.
45+
46+
<Message type="tip">
47+
Download the cluster's **kubeconfig** configuration file and make sure `kubectl` is configured to use the cluster's configuration before running any of the following commands. [Learn more.](/kubernetes/how-to/connect-cluster-kubectl/)
48+
</Message>
49+
50+
<Message type="note">
51+
This feature is currently in [Private Beta](https://www.scaleway.com/en/betas/#file-storage) and available to selected testers only. If you would like to sign up for the Private Beta to enable `ReadWriteMany`, fill out [this form](https://www.scaleway.com/en/betas/#file-storage).
52+
</Message>
53+
54+
You can run the following command to check that the CSI driver pods are running:
55+
56+
```bash
57+
kubectl get pods -n kube-system -l app=filestorage-csi-node
58+
```
59+
60+
You should see the `filestorage-csi-node` pods in a `Running` state.
61+
If you don't see any pod after running the previous command, make sure the `filestorage-csi-node` DaemonSet is present in your cluster (`$ kubectl get daemonset -n kube-system filestorage-csi-node`) and you have at least one pool with POP2 Instances.
62+
63+
## Using the Scaleway File Storage CSI Driver
64+
65+
The CSI driver supports dynamic provisioning of Persistent Volumes (PVs) and Persistent Volume Claims (PVCs).
66+
67+
### Creating a Persistent Volume Claim (PVC)
68+
69+
1. Create a file named `pvc.yaml`:
70+
71+
```yaml
72+
apiVersion: v1
73+
kind: PersistentVolumeClaim
74+
metadata:
75+
name: my-pvc
76+
spec:
77+
accessModes:
78+
- ReadWriteMany
79+
resources:
80+
requests:
81+
storage: 100G
82+
storageClassName: scw-fs
83+
```
84+
85+
<Message type="note">
86+
The minimum size for a File System is 100G.
87+
</Message>
88+
89+
Apply it:
90+
91+
```bash
92+
kubectl apply -f pvc.yaml
93+
```
94+
95+
2. Create a file named `pod.yaml`:
96+
97+
```yaml
98+
apiVersion: v1
99+
kind: Pod
100+
metadata:
101+
name: my-app
102+
spec:
103+
containers:
104+
- name: my-busybox
105+
image: busybox
106+
volumeMounts:
107+
- name: my-volume
108+
mountPath: "/data"
109+
command: ["/bin/sh", "-c"]
110+
args: ["tail -f /dev/null"]
111+
volumes:
112+
- name: my-volume
113+
persistentVolumeClaim:
114+
claimName: my-pvc
115+
```
116+
117+
Apply the pod configuration:
118+
119+
```bash
120+
kubectl apply -f pod.yaml
121+
```
122+
123+
3. Verify the mount:
124+
125+
```bash
126+
kubectl get pods
127+
kubectl exec -it my-app -- df -h /data
128+
```
129+
130+
### Importing an existing File Storage volume
131+
132+
<Message type="note">
133+
To import an existing File Storage volume you must have created it using the [Scaleway console](/file-storage/how-to/create-file-system/), [CLI](https://cli.scaleway.com/file/#create-a-new-filesystem), or the [File Storage API](https://www.scaleway.com/en/developers/api/file-storage/#path-filesystem-create-a-new-filesystem) prior the attachment.
134+
</Message>
135+
136+
1. Create a `pv-import.yaml` file:
137+
138+
```yaml
139+
apiVersion: v1
140+
kind: PersistentVolume
141+
metadata:
142+
name: test-pv
143+
spec:
144+
capacity:
145+
storage: 100G
146+
volumeMode: Filesystem
147+
accessModes:
148+
- ReadWriteMany
149+
storageClassName: scw-fs
150+
csi:
151+
driver: filestorage.csi.scaleway.com
152+
volumeHandle: fr-par/11111111-1111-1111-111111111111
153+
nodeAffinity:
154+
required:
155+
nodeSelectorTerms:
156+
- matchExpressions:
157+
- key: topology.filestorage.csi.scaleway.com/region
158+
operator: In
159+
values:
160+
- fr-par
161+
```
162+
163+
Replace `volumeHandle` with the actual ID of your existing volume.
164+
165+
Apply:
166+
167+
```bash
168+
kubectl apply -f pv-import.yaml
169+
```
170+
171+
2. Create `pvc-import.yaml`:
172+
173+
```yaml
174+
apiVersion: v1
175+
kind: PersistentVolumeClaim
176+
metadata:
177+
name: my-imported-pvc
178+
spec:
179+
accessModes:
180+
- ReadWriteMany
181+
resources:
182+
requests:
183+
storage: 100G
184+
storageClassName: scw-fs
185+
volumeName: test-pv
186+
```
187+
188+
Apply:
189+
190+
```bash
191+
kubectl apply -f pvc-import.yaml
192+
```
193+
194+
3. Create the pod (reuse the example from earlier with `claimName: my-imported-pvc`):
195+
196+
```yaml
197+
apiVersion: v1
198+
kind: Pod
199+
metadata:
200+
name: my-imported-app
201+
spec:
202+
containers:
203+
- name: my-busybox
204+
image: busybox
205+
volumeMounts:
206+
- name: my-volume
207+
mountPath: "/data"
208+
command: ["/bin/sh", "-c"]
209+
args: ["tail -f /dev/null"]
210+
volumes:
211+
- name: my-volume
212+
persistentVolumeClaim:
213+
claimName: my-imported-pvc
214+
```
215+
216+
Apply:
217+
218+
```bash
219+
kubectl apply -f pod.yaml
220+
```
221+
222+
4. Verify:
223+
224+
```bash
225+
kubectl get pods
226+
kubectl exec -it my-imported-app -- ls /data
227+
```
228+
229+
### Using a custom storage class
230+
231+
1. Create `storageclass.yaml`:
232+
233+
```yaml
234+
apiVersion: storage.k8s.io/v1
235+
kind: StorageClass
236+
metadata:
237+
name: my-default-storage-class
238+
provisioner: filestorage.csi.scaleway.com
239+
reclaimPolicy: Delete
240+
```
241+
242+
Apply:
243+
244+
```bash
245+
kubectl apply -f storageclass.yaml
246+
```
247+
248+
2. Update the PVC to use this storage class:
249+
250+
```yaml
251+
apiVersion: v1
252+
kind: PersistentVolumeClaim
253+
metadata:
254+
name: my-pvc
255+
spec:
256+
accessModes:
257+
- ReadWriteMany
258+
resources:
259+
requests:
260+
storage: 100G
261+
storageClassName: my-default-storage-class
262+
```
263+
264+
### Specifying the region
265+
266+
To specify a region explicitly for volume creation:
267+
268+
```yaml
269+
apiVersion: storage.k8s.io/v1
270+
kind: StorageClass
271+
metadata:
272+
name: my-par-storage-class
273+
provisioner: filestorage.csi.scaleway.com
274+
reclaimPolicy: Delete
275+
allowedTopologies:
276+
- matchLabelExpressions:
277+
- key: topology.filestorage.csi.scaleway.com/region
278+
values:
279+
- fr-par
280+
```
281+
282+
<Message type="tip">
283+
For further information, refer to the [Scaleway File Storage CSI driver](https://github.com/scaleway/scaleway-filestorage-csi/tree/main) documentation.
284+
</Message>

pages/kubernetes/menu.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ export const kubernetesMenu = {
101101
label: 'Recover ETCD database space for a cluster',
102102
slug: 'recover-space-etcd',
103103
},
104+
{
105+
"label": "How to use SFS with Kubernetes Kapsule",
106+
"slug": "use-sfs-with-kubernetes"
107+
},
104108
{
105109
label: 'Enable or disable SSH',
106110
slug: 'enable-disable-ssh',

0 commit comments

Comments
 (0)