|
| 1 | +# RBS CSI Driver |
| 2 | + |
| 3 | +Kubernetes CSI driver for Remote Block Storage (RBS) - dynamic provisioning and management of iSCSI block volumes. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Dynamic volume provisioning via RBS API |
| 8 | +- iSCSI block device attachment |
| 9 | +- Online volume expansion |
| 10 | +- Multiple filesystems: ext4, ext3, xfs, btrfs |
| 11 | +- CHAP authentication |
| 12 | +- **PVC naming** - volumes named by PVC instead of UUID |
| 13 | +- **Label propagation** - StorageClass → PVC → RBS volume labels |
| 14 | +- **Idempotent operations** - safe retries via label lookup |
| 15 | + |
| 16 | +## Quick Start |
| 17 | + |
| 18 | +```bash |
| 19 | +# 1. Create credentials secret |
| 20 | +kubectl create secret generic rbs-csi-secret \ |
| 21 | + --from-literal=api-url="https://api.servers.com/v1" \ |
| 22 | + --from-literal=api-token="your-api-token" \ |
| 23 | + --namespace=kube-system |
| 24 | + |
| 25 | +# 2. Deploy driver |
| 26 | +kubectl apply -f deploy/rbac.yaml |
| 27 | +kubectl apply -f deploy/csi-driver.yaml |
| 28 | +kubectl apply -f deploy/controller.yaml |
| 29 | +kubectl apply -f deploy/node-daemonset.yaml |
| 30 | + |
| 31 | +# 3. Create StorageClass |
| 32 | +kubectl apply -f examples/storageclass.yaml |
| 33 | + |
| 34 | +# 4. Create PVC |
| 35 | +kubectl apply -f examples/pvc.yaml |
| 36 | +``` |
| 37 | + |
| 38 | +## Configuration |
| 39 | + |
| 40 | +### StorageClass Parameters |
| 41 | + |
| 42 | +```yaml |
| 43 | +apiVersion: storage.k8s.io/v1 |
| 44 | +kind: StorageClass |
| 45 | +metadata: |
| 46 | + name: rbs-ssd |
| 47 | + labels: |
| 48 | + environment: production |
| 49 | +provisioner: rbs.csi.servers.com |
| 50 | +parameters: |
| 51 | + rbs.csi.servers.com/location: "40" |
| 52 | + rbs.csi.servers.com/flavor: "16997" |
| 53 | + # names for location and flavor also supported |
| 54 | + # rbs.csi.servers.com/flavor: "SSD-High" |
| 55 | + # rbs.csi.servers.com/location: "AMS1" |
| 56 | + rbs.csi.servers.com/labels: | |
| 57 | + { |
| 58 | + "managed-by": "kubernetes" |
| 59 | + } |
| 60 | +allowVolumeExpansion: true |
| 61 | +volumeBindingMode: WaitForFirstConsumer |
| 62 | +``` |
| 63 | +
|
| 64 | +## Label Propagation |
| 65 | +
|
| 66 | +Labels merge with priority: **System > PVC > StorageClass** |
| 67 | +
|
| 68 | +Example: |
| 69 | +```yaml |
| 70 | +# StorageClass labels |
| 71 | +metadata: |
| 72 | + labels: |
| 73 | + environment: production |
| 74 | + |
| 75 | +--- |
| 76 | +# PVC labels |
| 77 | +metadata: |
| 78 | + labels: |
| 79 | + app: database |
| 80 | + environment: staging # Overrides StorageClass |
| 81 | + |
| 82 | +# Result on RBS volume: |
| 83 | +# { |
| 84 | +# "pvc-uuid": "abc-123", |
| 85 | +# "pvc-namespace": "default", |
| 86 | +# "app": "database", |
| 87 | +# "environment": "staging" |
| 88 | +# } |
| 89 | +``` |
| 90 | + |
| 91 | +## Architecture |
| 92 | + |
| 93 | +**CSI Controller** (Deployment): |
| 94 | +- CreateVolume, DeleteVolume, ExpandVolume |
| 95 | +- RBS API integration |
| 96 | + |
| 97 | +**CSI Node** (DaemonSet): |
| 98 | +- StageVolume, UnstageVolume |
| 99 | +- iSCSI discovery and login |
| 100 | +- Filesystem formatting and mounting |
| 101 | + |
| 102 | +## Examples |
| 103 | + |
| 104 | +### Basic PVC |
| 105 | + |
| 106 | +```yaml |
| 107 | +apiVersion: v1 |
| 108 | +kind: PersistentVolumeClaim |
| 109 | +metadata: |
| 110 | + name: my-data |
| 111 | + labels: |
| 112 | + app: nginx |
| 113 | +spec: |
| 114 | + accessModes: |
| 115 | + - ReadWriteOnce |
| 116 | + storageClassName: rbs-ssd |
| 117 | + resources: |
| 118 | + requests: |
| 119 | + storage: 10Gi |
| 120 | +``` |
| 121 | +
|
| 122 | +### Volume Expansion |
| 123 | +
|
| 124 | +```yaml |
| 125 | +spec: |
| 126 | + resources: |
| 127 | + requests: |
| 128 | + storage: 20Gi # Increased from 10Gi |
| 129 | +``` |
| 130 | +
|
| 131 | +
|
| 132 | +## License |
| 133 | +
|
| 134 | +Apache 2.0 |
0 commit comments