Dynamic Provisioning
Automated Bucket Creation
With dynamic provisioning, S3 buckets are created automatically when PersistentVolumeClaims are created, eliminating the need for pre-existing buckets.
Dynamic provisioning enables on-demand creation of S3 buckets and PersistentVolumes through Kubernetes' native storage provisioning system. When a PersistentVolumeClaim (PVC) references a StorageClass with the Scality S3 CSI provisioner, the system automatically creates both the S3 bucket and corresponding PersistentVolume (PV).
How Dynamic Provisioning Works
Workflow Overview
sequenceDiagram
participant Developer
participant K8s as Kubernetes
participant Provisioner as CSI Provisioner
participant Controller as CSI Controller
participant S3 as S3 Storage
Developer->>K8s: Create PVC referencing StorageClass
K8s->>K8s: Queue PVC (status: Pending)
Provisioner->>K8s: Watch for new PVCs
K8s-->>Provisioner: PVC event notification
Provisioner->>Controller: CreateVolume RPC
Controller->>Controller: Generate Volume ID (csi-s3-{uuid})
Controller->>S3: Create S3 bucket with Volume ID as name
S3-->>Controller: Bucket created
Controller-->>Provisioner: Volume created response (includes Volume ID)
Provisioner->>K8s: Create PersistentVolume with Volume ID
K8s->>K8s: Bind PV to PVC
K8s-->>Developer: PVC ready for use
Core Components
- StorageClass: Defines provisioning parameters and credentials
- CSI Provisioner: Watches for PVCs and triggers volume creation
- CSI Controller: Handles S3 bucket creation and deletion
- PersistentVolumeClaim: Requests storage with specific requirements
Volume ID System
The CSI driver ensures perfect consistency between Kubernetes resources and S3 storage through a unified volume identification system:
- Volume ID Generation: Each volume gets a unique identifier:
csi-s3-{uuid}
- Dual Purpose: This ID serves as both the CSI Volume ID (stored in PersistentVolume) and the S3 bucket name
- Lifecycle Consistency: Creation and deletion operations use the same identifier, eliminating any ambiguity about which bucket corresponds to which volume
Key Requirements
Requirement | Description | Example |
---|---|---|
StorageClass | Must specify s3.csi.scality.com as provisioner |
See StorageClass Reference |
Credentials | Provisioner and node secrets for S3 operations | See Credential Management |
Basic Configuration
StorageClass Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
PersistentVolumeClaim Example
1 2 3 4 5 6 7 8 9 10 11 |
|
Volume Binding Modes
Immediate Binding (Default)
- PV created immediately when PVC is created
- Bucket created before pod scheduling
- Suitable for most use cases
Immediate binding example | |
---|---|
1 2 3 4 5 6 7 8 9 10 |
|
WaitForFirstConsumer
- PV creation delayed until pod is scheduled
- Ensures bucket is created in optimal location
- Recommended if using
${pv.name}
templating in StorageClass parameters
WaitForFirstConsumer binding example | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Lifecycle Management
Bucket Creation
- Automatic Naming: Buckets use
csi-s3-{uuid}
format (e.g.,csi-s3-12345678-abcd-1234-abcd-123456789012
) - Volume ID Consistency: The same identifier is used as both the CSI Volume ID and S3 bucket name
- Bucket Configuration: Created with default configuration using S3 API CreateBucket
Bucket Deletion
Controlled by the reclaimPolicy
:
- Delete: Bucket deleted when PVC is deleted (only if bucket is empty) using S3 API DeleteBucket
- Retain: Bucket preserved after PVC deletion
1 |
|
S3 Bucket Deletion Behavior
When using reclaimPolicy: Delete
, S3 bucket deletion only occurs if the bucket is completely empty.
If the bucket contains any objects, the bucket will be retained as a safety mechanism to prevent accidental data loss.
Kubernetes resources (PVC, PV) will be successfully deleted, but the actual bucket remains in S3 storage.
Mount Options
Dynamic provisioning supports all mount options through the StorageClass specification:
Authentication
Dynamic provisioning requires two sets of credentials. If either or both credential types are missing from the StorageClass configuration, the CSI driver will fall back to the default driver-level credentials.
- Provisioner Secrets: Used by CSI controller for bucket creation and deletion
- Node Secrets: Used by nodes for mounting operations
See the Credential Management Guide for detailed configuration.
Limitations
- Single Access Mode: Only
ReadWriteMany
is supported - S3 Bucket Deletion: Bucket deletion only occurs when completely empty (no objects)
Next Steps
- Learn about StorageClass Parameters
- Set up Credential Management