-
Notifications
You must be signed in to change notification settings - Fork 245
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
bene2k1
wants to merge
7
commits into
main
Choose a base branch
from
MTA-6299
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cdb73d0
feat(k8s): use of sfs with k8s
bene2k1 43f4452
feat(k8s): sfs
bene2k1 02345b9
feat(k8s): use sfs
bene2k1 5acf540
feat(k8s): sfs
bene2k1 5060f2e
feat(k8s): update content
bene2k1 6df1459
Update pages/kubernetes/how-to/use-sfs-with-kubernetes.mdx
bene2k1 b58d64c
Apply suggestions from code review
bene2k1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
bene2k1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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 | ||
bene2k1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.