######## STORAGECLASS and in-tree/CSI driver. #######
This provisioning is based on Storage Classes, the PVC must request a storage class and the administrator must have created and configured that storage class for dynamic provisioning to occur.
- Storage Class allows dynamic provisioning of Persistent Volumes, when PVC claims it.
- Storage Class abstracts underlying storage provider.
- Storage Class is used in conjunction with PVC that allow Pods to dynamically request a new storage.
- Storage Class use provisioners that are specific to the storage platform or cloud provider to give Kubernetes access to the physical storage.
- Each storage backend has own provisioner. Storage Backend is defined in the Storage Class component via provisioner attribute.
https://storageclass.info/csidrivers/
# kubectl get storageclass
Column | Description |
NAME | Name of the StorageClass |
PROVISIONER | Storage backend (CSI driver) responsible for provisioning PVs |
RECLAIMPOLICY | What happens to a PersistentVolume (PV) after a PersistentVolumeClaim (PVC) is deleted |
VOLUMEBINDINGMODE | When the volume gets provisioned and bound to a PVC |
ALLOWVOLUMEEXPANSION | Whether the PVC size can be increased dynamically |
AGE | Time since the StorageClass was created |
1.PROVISIONER (Storage Backend or CSI Driver)
Defines which storage provisioner (CSI driver) is used for creating PersistentVolumes (PVs).
Provisioner | Description |
nfs.csi.k8s.io | NFS storage (used for shared storage) |
ebs.csi.aws.com | AWS Elastic Block Store (EBS) |
pd.csi.storage.gke.io | Google Cloud Persistent Disk |
disk.csi.azure.com | Azure Managed Disk |
ceph.rbd.csi.ceph.com | Ceph RBD (block storage) |
kubernetes.io/no-provisioner | Manual PV provisioning (static volumes) |
2.RECLAIMPOLICY (What Happens to PV After PVC Deletion?)
Controls whether a PersistentVolume (PV) is deleted or retained when the PersistentVolumeClaim (PVC) is removed.
Policy | Description |
Delete | PV is deleted when PVC is deleted (Dynamic PVs) |
Retain | PV is kept, even after PVC is deleted (Requires manual cleanup) |
3.VOLUMEBINDINGMODE (When PV is Bound to PVC)
Determines when the PV is allocated and bound to a PVC.
Mode | Description |
Immediate | PV is provisioned as soon as PVC is created |
WaitForFirstConsumer | PV is provisioned only when a Pod uses the PVC |
4.ALLOWVOLUMEEXPANSION (Can PVC Size Be Increased?)
Defines whether a PersistentVolumeClaim (PVC) can be resized after creation.
Value | Description |
TRUE | PVC can be expanded |
FALSE | PVC size cannot be changed |
5.AGE (How Old is the StorageClass?)
Shows the time elapsed since the StorageClass was created.
In-tree/CSI driver for k8s.
In-tree driver
:-
In-tree means that the storage provisioner
is built inside the Kubernetes core codebase. Kubernetes itself manages
the storage backend directly.
Example: nfs-subdir-external-provisioner
- The nfs-subdir-external-provisioner
is an in-tree NFS provisioner.
- It is implemented as a deployment
inside Kubernetes, using a pod that manages NFS storage.
- It is NOT a true CSI driver, but it allows dynamic provisioning of NFS storage.
✅ Pros
✔ Simple to set up.
✔ Works well with NFS storage.
✔ Good for small-scale environments.
❌ Cons
✖ Deprecated in newer Kubernetes
versions (in-tree storage provisioners are being removed).
✖ Limited features (no snapshots, no volume
expansion, etc.).
CSI
(Container Storage Interface) Storage Provisioner (csi-driver-nfs)
The CSI
(Container Storage Interface) is the modern way to integrate
external storage into Kubernetes. CSI drivers are not part of
Kubernetes core but are deployed as separate components.
- Find the driver :-
https://storageclass.info/csidrivers/
1.Check cisdrivers
# kubectl
get csidrivers
🔹 Example: csi-driver-nfs
- csi-driver-nfs is a true CSI
driver for NFS storage.
- It provides full CSI
capabilities such as snapshots, volume expansion, and multi-tenancy.
- Installed as a DaemonSet and
StatefulSet in Kubernetes.
✅ Pros
✔ Future-proof (supported in all
modern Kubernetes versions).
✔ Supports snapshots, volume expansion, and advanced
storage features.
✔ Uses Kubernetes CSI standards, making it more
flexible and scalable.
❌ Cons
✖ More complex setup compared to
in-tree provisioners.
✖ Requires additional components to be installed (CSI
controllers).
Explanation
of Each Column
1.
NAME:
o The name of the CSI driver.
o Here, nfs.csi.k8s.io refers to the NFS
CSI driver used for handling NFS storage in Kubernetes.
2.
ATTACHREQUIRED
(attachRequired field in CSIDriver API):
o Specifies whether the driver requires
Kubernetes to attach volumes before mounting.
o false means no attachment is needed
(common for NFS, as it is network-based and does not require attaching a block
device).
3.
PODINFOONMOUNT
(podInfoOnMount field):
o Determines if Kubernetes should pass pod
information (such as namespace, service account, and UID) to the CSI driver
during volume mount.
o false means pod information is not
required by the NFS CSI driver.
4.
STORAGECAPACITY
(storageCapacity field):
o Indicates whether the CSI driver
supports dynamic provisioning and tracks storage capacity.
o false means this driver does not
support storage capacity tracking.
5.
TOKENREQUESTS:
o Used when a CSI driver requires a
Kubernetes service account token for authentication.
o <unset> means no token is
required.
6.
REQUIRESREPUBLISH (requiresRepublish field):
o Specifies whether the CSI driver requires
Kubernetes to periodically send volume publish requests.
o false means re-publishing is not
required.
7.
MODES (VolumeLifecycleModes
field):
o Indicates how the CSI driver handles
volume lifecycles.
o Persistent means it supports PersistentVolumes
(PVs) that remain available across pod restarts.
8.
AGE:
o The time since the CSI driver resource was created in the cluster (2m35s means it's been running for 2 minutes and 35 seconds).
Summary:
In-Tree vs. CSI-Based NFS Provisioners
Feature |
In-Tree (nfs-subdir-external-provisioner) |
CSI (csi-driver-nfs) |
Installation |
Simple Deployment |
Requires DaemonSet & StatefulSet |
StorageClass Provisioner |
nfs-subdir-external-provisioner |
nfs.csi.k8s.io |
Supports Snapshots |
❌ No |
✅ Yes |
Supports Volume Expansion |
❌ No |
✅ Yes |
Future Kubernetes Support |
❌ Deprecated |
✅ Actively Supported |
Complexity |
✅ Easy to use |
❌ More setup required |
1️.Cloud Storage CSI Drivers
- Amazon EBS CSI Driver → ebs.csi.aws.com
- Amazon EFS CSI Driver → efs.csi.aws.com
- Google Cloud Persistent Disk CSI
Driver → pd.csi.storage.gke.io
- Azure Disk CSI Driver → disk.csi.azure.com
- Azure File CSI Driver → file.csi.azure.com
- OpenStack Cinder CSI Driver → cinder.csi.openstack.org
2️.On-Premises & Software-Defined Storage CSI Drivers
- Ceph RBD CSI Driver → rbd.csi.ceph.com
- CephFS CSI Driver → cephfs.csi.ceph.com
- GlusterFS CSI Driver → glusterfs.csi.k8s.io
- NFS CSI Driver → nfs.csi.k8s.io
- iSCSI CSI Driver → iscsi.csi.k8s.io
3️.
Enterprise & Vendor-Specific Storage CSI Drivers
- VMware vSphere CSI Driver → vsphere.csi.vmware.com
- Dell EMC PowerMax CSI Driver → powermax.csi.dell.com
- Dell EMC PowerScale CSI Driver → powerscale.csi.dell.com
- Dell EMC PowerFlex CSI Driver → powerflex.csi.dell.com
- NetApp Trident CSI Driver → trident.netapp.io
- HPE CSI Driver for 3PAR and
Primera → hpe.csi.k8s.io
4️.Community & General-Purpose CSI Drivers
- Local Persistent Volume CSI
Driver → local.csi.k8s.io
- HostPath CSI Driver (for testing
purposes) → hostpath.csi.k8s.io
- Longhorn CSI Driver (for Rancher users) → longhorn.io
- MinIO NAS Gateway CSI Driver → minio.csi.k8s.io
The CSINode resource provides
information about CSI drivers installed on a specific Kubernetes node.
# kubectl
get csinodes
The CSIStorageCapacity
resource provides real-time information about the available storage capacity
for a specific CSI storage driver.
CSI
(Container Storage Interface) released in Kubernetes v1.9 (Alpha - December
2017).
Purpose
- Helps Kubernetes schedule
pods based on storage availability.
- Avoids storage
over-provisioning.
- Used mainly for dynamic provisioning of storage in multi-node clusters.
# kubectl get csistoragecapacities
Summary: CSINode
vs. CSIStorageCapacity
1.Check
If the Storage Provisioner Is Installed.
# kubectl
get pods -n kube-system | grep csi
2.Check
If a Default StorageClass Exists.
# kubectl
get storageclass | grep '(default)'
# kubectl
annotate storageclass nfs-storage storageclass.kubernetes.io/is-default-class=true
# kubectl
get storageclass
3.Restart
kubelet and Controller Manager.
# systemctl
restart kubelet
For
controller-manager (on master node):
# kubectl
delete pod -n kube-system -l component=kube-controller-manager
3.Check CSI
driver.
csidrivers.storage.k8s.io
# kubectl get csidrivers
# kubectl get csinodes
# kubectl getcsistoragecapacities
Check logs
kubectl logs -n kube-system -l app=csi-nfs-controller
No comments:
Post a Comment