Storage Configuration
This guide covers persistent storage configuration in Krutrim Kubernetes Service using Container Storage Interface (CSI) drivers.
Understanding Storage in Kubernetes
Kubernetes provides several storage abstractions:
Volumes: Temporary storage tied to pod lifecycle
PersistentVolumes (PV): Cluster-level storage resources
PersistentVolumeClaims (PVC): User requests for storage
StorageClass: Dynamic provisioning configuration
CSI Add-on Overview
The Container Storage Interface (CSI) driver enables dynamic storage provisioning in your cluster.
What is CSI?
CSI is a standard interface for exposing block and file storage systems to containerized workloads on Kubernetes.
Benefits:
✅ Dynamic volume provisioning
✅ Automatic volume creation
✅ Volume snapshots
✅ Volume expansion
✅ Integration with cloud storage
Critical: CSI Add-on Requirement
Default storage class is ONLY available if CSI Node Plugin add-on is enabled.
Without CSI:
❌ No default storage class
❌ Cannot create PersistentVolumeClaims
❌ No dynamic volume provisioning
With CSI:
✅ Default storage class available
✅ Can create PersistentVolumeClaims
✅ Dynamic volume provisioning works
Installing CSI Add-on
Install the CSI add-on to enable persistent storage in your cluster.
Configuring Persistent Storage
Prerequisites
Before configuring storage, ensure:
✅ CSI Node Plugin Installed:
CSI Node Plugin add-on: ACTIVE
Verify Installation
Understanding Storage Classes
Available Storage Classes
Once the CSI add-on is installed, a default storage class is automatically configured for your cluster.
Default Storage Class
After CSI installation, the default storage class is automatically created:
Storage Class Parameters
Provisioner: cinder.csi.openstack.org
Uses OpenStack Cinder for block storage
Provides persistent volumes backed by cloud storage
Reclaim Policy: Delete
Volumes are deleted when PVC is deleted
Data is permanently removed
Use caution with production data
Volume Binding Mode: Immediate
Volume is created immediately when PVC is created
Does not wait for pod to be scheduled
Volume may be created in different zone than pod
Allow Volume Expansion: true
Volumes can be resized after creation
Requires PVC and pod restart
Using Persistent Storage
Creating a PersistentVolumeClaim
Basic PVC
Apply PVC:
Check PVC Status:
Access Modes
ReadWriteOnce (RWO):
Volume can be mounted read-write by a single node
Most common mode
Supported by default storage class
ReadOnlyMany (ROX):
Volume can be mounted read-only by multiple nodes
Less common
Check if supported
ReadWriteMany (RWX):
Volume can be mounted read-write by multiple nodes
Requires special storage types (not block storage)
Not supported by default Cinder CSI
Using PVC in Pods
Pod with Volume Mount
StatefulSet with Volume Claim Template
Benefits of VolumeClaimTemplates:
Each pod gets its own PVC
PVC name includes pod name (data-database-0, data-database-1, etc.)
Automatic creation and management
Common Storage Scenarios
Scenario 1: Web Application with User Uploads
Scenario 2: Database with Persistent Storage
Scenario 3: Shared Configuration Files
Note: Use ConfigMap for configuration, PVC for data
Scenario 4: Multiple Containers Sharing Data
Managing Storage
Viewing Storage Resources
Expanding Volumes
The default storage class supports volume expansion.
Step: Edit PVC
Step: Increase Size (example)
Step: Restart Pod
Verification:
Important notes:
Can only increase size, not decrease
Pod must be restarted for filesystem resize
Some storage backends may take time to expand
Deleting Storage
Delete PVC:
What happens:
PVC is deleted
PV is deleted (due to
Deletereclaim policy)Underlying storage is removed
Data is permanently lost
Warning: Deleting PVC deletes data permanently!
Protecting Important Data:
Option 1: Change Reclaim Policy
Option 2: Backup Before Deletion
Option 3: Don't Delete PVC
Keep PVC even if not in use
PVC doesn't cost money, storage does
Reattach to new pods when needed
Storage Best Practices
Anti-Patterns / Don'ts
Troubleshooting Storage
PVC Stuck in Pending
Symptoms:
PVC status remains
PendingNo PV created
Possible Causes:
CSI add-on not installed
Storage provisioning in progress
Storage quota exceeded
Solution:
Pod Cannot Mount Volume
Symptoms:
Pod in
ContainerCreatingstateEvents show volume mount errors
Possible Causes:
PVC not bound
Node doesn't have CSI driver
Volume in use by another pod (RWO)
Solution:
Volume Out of Space
Symptoms:
Application errors writing to disk
Pod logs show "no space left on device"
Solution:
Storage Class Not Found
Symptoms:
PVC pending with "no storage class found"
kubectl get storageclassshows nothing
Solution:
Storage Sizing Guidelines
Application Types
Small Applications / Development:
Medium Applications / Production:
Databases:
File Storage / Media:
Monitoring / Logging:
Additional Resources
Installing Add-ons - Install CSI add-ons
Best Practices - Storage optimization tips
Troubleshooting Guide - Common storage issues
Last updated
Was this helpful?

