This article highlights the procedure on how to import an existing Crusoe volume as a PV/PVC into the CMK cluster.
Pre-Requirements
- Access to a Kubernetes cluster created through Crusoe Managed Kubernetes (CMK) offering. Note that the Crusoe CSI Driver is only supported on CMK.
- Access to Crusoe CLI/UI/API
Steps to Install
- Identify the Volume using Crusoe CLI
$ crusoe storage disks get <disk_name>
Example:
$ crusoe storage disks get persistent-icat
name: persistent-icat
id: 9eddc28c-262b-4d24-ad3b-8c90ef8c3da7
attached_to: none
created_at: 2025-04-25T18:06:53Z
location: eu-iceland1-a
serial_number: 4D665A4FF32FT4B2053
size: 10TiB
type: persistent-ssd - Create Persistent Volume
Example for Persistent Disk:
kind: PersistentVolume
Example for Shared Disk:
apiVersion: v1
metadata:
name: crusoe-persistent-pv
spec:
capacity:
storage: 10Ti # Must match PVC and with existing Crusoe Disk size
accessModes:
- ReadWriteOnce
storageClassName: crusoe-csi-driver-ssd-sc
volumeMode: Filesystem # Supported modes are Block and Filesystem
persistentVolumeReclaimPolicy: Retain
csi:
driver: ssd.csi.crusoe.ai
readOnly: false
volumeHandle: 9eddc28c-262b-4d24-ad3b-8c90ef8c3da7 # Must match spec to Crusoe Disk ID
volumeAttributes:
csi.crusoe.ai/disk-name: persistent-icat # Must match spec to Crusoe Disk Name
csi.crusoe.ai/serial-number: 4D665A4FF32T64B2053 # Must match spec to Crusoe Disk Serial Number
kind: PersistentVolume
Note:
apiVersion: v1
metadata:
name: crusoe-shared-pv
spec:
capacity:
storage: 8Ti # Must match PVC and with existing Crusoe Disk size
accessModes:
- ReadWriteMany
storageClassName: crusoe-csi-driver-ssd-sc
volumeMode: Filesystem # Supported modes Filesystem
persistentVolumeReclaimPolicy: Retain
csi:
driver: fs.csi.crusoe.ai
readOnly: false
volumeHandle: ta0eb851-49a1-497e-ad23-f26f364cfbef # Must match spec to Crusoe Disk ID
volumeAttributes:
csi.crusoe.ai/disk-name: shared-disk-icat # Must match spec to Crusoe Disk Name
csi.crusoe.ai/serial-number: 47C58J8CBD2A908866C # Must match spec to Crusoe Disk Serial Number
=> The driver for Persistent Disks is `ssd.csi.crusoe.ai` and for shared disks is `fs.csi.crusoe.ai`.
=> Also, for Shared-Disks, the supported access modes are ReadWriteOnce & ReadWriteMany while for Persistent Disks it is ReadWriteOnce. - Create Persistent Volume Claim
Example for Persistent Disk:
kind: PersistentVolumeClaim
Example for Shared Disk:
apiVersion: v1
metadata:
name: crusoe-persistent-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: crusoe-csi-driver-ssd-sc
resources:
requests:
storage: 10Ti
volumeMode: Filesystem
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: crusoe-shared-pvc
spec:
accessModes:
- ReadWriteMany
storageClassName: crusoe-csi-driver-ssd-sc
resources:
requests:
storage: 8Ti
volumeMode: Filesystem - Create Deployment referencing the PV/PVC resources
Example:
apiVersion: apps/v1
Example:
kind: Deployment
metadata:
name: crusoe-deployment
spec:
replicas: 1
selector:
matchLabels:
app: crusoe-deployment
template:
metadata:
labels:
app: crusoe-deployment
spec:
terminationGracePeriodSeconds: 0
containers:
- name: my-import-deployment
image: ubuntu:24.04
command: ["sleep", "infinity"]
volumeMounts:
- mountPath: "/opt/persistent-volume"
name: myvolume
- mountPath: "/opt/shared-volume"
name: sharedvolume
volumes:
- name: myvolume
persistentVolumeClaim:
claimName: crusoe-persistent-pvc
readOnly: false
- name: sharedvolume
persistentVolumeClaim:
claimName: crusoe-shared-pvc
readOnly: false
$ kubectl exec -it crusoe-deployment-6fcfdfc4fb-xs9fk -- bash
# ls -lrt /opt/
total 4
drwxrwxrwx. 2 root root 4096 Apr 29 16:05 shared-volume
drwxr-xr-x 3 root root 4096 Apr 29 16:28 persistent-volume
Potential Errors
Location Mismatch between CMK cluster and Disk Location
AttachVolume.Attach failed for volume "crusoe-persistent-pv" : rpc error:
code = Internal desc = failed to get result of disk attachment: operation failed:
The disk location does not match the VM location.
Please choose a disk in the same location as the VM and try again.
Persistent Disk Attached to a Instance
AttachVolume.Attach failed for volume "crusoe-persistent-pv" : rpc error:
code = Internal desc =failed to attach disk: 400 Bad Request
disk 'persistent-icat' (id: 9eddc28c-262b-4d24-ad3b-8c90ef8c3da7) is already attached
in read-write mode to an instance (4534ff88-28k6-21bf-bdc2-76k98cbc8b2a).
persistent disks can only be attached to a single instance at a time in read-write mode
Additional Resources
Comments
0 comments
Please sign in to leave a comment.