Examples
Embedded example manifests for common setups.
rclone-secret.yaml
---
apiVersion: v1
kind: Secret
metadata:
name: rclone-secret
namespace: default
type: Opaque
stringData:
# Default remote configuration
# These values can be overridden by volumeAttributes in PV/StorageClass
remote: "s3"
remotePath: "mybucket"
configData: |
[s3]
type = s3
provider = Minio
endpoint = http://localhost:30900
access_key_id = admin
secret_access_key = password
---
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
pv.kubernetes.io/provisioned-by: rclone.csi.veloxpack.io
name: pv-nginx
namespace: default
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
csi:
driver: rclone.csi.veloxpack.io
volumeHandle: data-id
nodePublishSecretRef:
name: rclone-secret
namespace: default
# volumeAttributes:
# remote: "s3"
# remotePath: "mybucket"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-nginx
namespace: default
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
volumeName: pv-nginx
storageClassName: ""
---
apiVersion: v1
kind: Pod
metadata:
name: nginx-rclone-example
namespace: default
spec:
containers:
- image: nginx
name: nginx
ports:
- containerPort: 80
protocol: TCP
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
volumeMounts:
- name: pvc-nginx
mountPath: /usr/share/nginx/html
readOnly: false
volumes:
- name: pvc-nginx
persistentVolumeClaim:
claimName: pvc-nginxrclone-pv-example.yaml
---
# Rclone CSI Driver - PersistentVolume Example
# This example demonstrates how to create a PersistentVolume with inline rclone configuration
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
pv.kubernetes.io/provisioned-by: rclone.csi.veloxpack.io
name: pv-rclone-example
namespace: default
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany # Rclone supports ReadWriteMany for cloud storage
persistentVolumeReclaimPolicy: Delete
mountOptions:
- debug-fuse
csi:
driver: rclone.csi.veloxpack.io
volumeHandle: rclone-pv-example-volume
volumeAttributes:
remote: "s3"
remotePath: "mybucket"
# Inline rclone configuration for MinIO S3-compatible storage
configData: |
[s3]
type = s3
provider = Minio
endpoint = http://localhost:30900
access_key_id = admin
secret_access_key = password
---
# PersistentVolumeClaim that references the above PV
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-rclone-example
namespace: default
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
volumeName: pv-rclone-example
storageClassName: "" # Empty string means no dynamic provisioning
---
# Example application pod using the rclone volume
apiVersion: v1
kind: Pod
metadata:
name: rclone-test-app
namespace: default
spec:
containers:
- image: nginx
name: web-server
ports:
- containerPort: 80
protocol: TCP
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
volumeMounts:
- name: rclone-storage
mountPath: /usr/share/nginx/html
readOnly: false
# Example: Create a test file to verify rclone mount works
command: ["/bin/sh"]
args: ["-c", "echo 'Hello from rclone CSI driver!' > /usr/share/nginx/html/index.html && nginx -g 'daemon off;'"]
volumes:
- name: rclone-storage
persistentVolumeClaim:
claimName: pvc-rclone-examplenginx-dynamic-path.yaml
# Example: Dynamic Path Generation with StorageClass
#
# This example demonstrates the new template variable syntax for multi-tenant storage.
# The CSI driver will automatically substitute PVC/PV metadata into the remotePath.
#
# Supported template variables:
# ${pvc.metadata.name} - Name of the PersistentVolumeClaim
# ${pvc.metadata.namespace} - Namespace of the PersistentVolumeClaim
# ${pv.metadata.name} - Name of the PersistentVolume
---
# StorageClass with dynamic path generation
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: rclone-s3-multitenant
provisioner: rclone.csi.veloxpack.io
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: false
parameters:
# Remote configuration (Minio S3)
remote: "s3"
# Dynamic path with namespace and PVC name isolation
# Each PVC gets its own isolated directory: buckets/<namespace>/<pvc-name>
remotePath: "buckets/${pvc.metadata.namespace}/${pvc.metadata.name}"
# Rclone configuration (for demo - use secrets in production!)
configData: |
[s3]
type = s3
provider = Minio
endpoint = http://localhost:9000
access_key_id = admin
secret_access_key = password
---
# PersistentVolumeClaim in the 'production' namespace
# Will result in remotePath: buckets/production/data-store
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: data-store
namespace: production
spec:
accessModes:
- ReadWriteOnce
storageClassName: rclone-s3-multitenant
resources:
requests:
storage: 10Gi
---
# PersistentVolumeClaim in the 'staging' namespace
# Will result in remotePath: buckets/staging/cache-volume
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cache-volume
namespace: staging
spec:
accessModes:
- ReadWriteMany
storageClassName: rclone-s3-multitenant
resources:
requests:
storage: 5Gi
---
# Pod using the production PVC
apiVersion: v1
kind: Pod
metadata:
name: nginx-production
namespace: production
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
volumeMounts:
- name: storage
mountPath: /usr/share/nginx/html
volumes:
- name: storage
persistentVolumeClaim:
claimName: data-store
---
# Pod using the staging PVC
apiVersion: v1
kind: Pod
metadata:
name: nginx-staging
namespace: staging
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
volumeMounts:
- name: cache
mountPath: /var/cache/nginx
volumes:
- name: cache
persistentVolumeClaim:
claimName: cache-volumeHow is this guide?