Docker and k8s: Container Storage Interface (CSI) Drivers

Peter Jeon·2023년 6월 14일

Docker and k8s

목록 보기
40/41

CSI Drivers

Container Storage Interface (CSI) is a standard for exposing arbitrary block and file storage systems to containerized workloads on Kubernetes. With the advent of CSI, developers can use different storage systems on a Kubernetes cluster without needing to modify the Kubernetes codebase.

What are CSI Drivers?

CSI drivers are the plugins that enable the use of a storage system with Kubernetes using the Container Storage Interface (CSI). They are developed by storage vendors to create a standardized way to connect to their storage solutions.

Installing a CSI Driver

Installing a CSI Driver on your Kubernetes cluster involves deploying certain Kubernetes objects. Here is a sample command to install the GCE Persistent Disk CSI Driver:

kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/master/deploy/kubernetes/base-setup.yaml

This command downloads the CSI driver's Kubernetes deployment YAML file from its repository and deploys it on your Kubernetes cluster.

Using a CSI Driver

After installing a CSI driver, you can create a PersistentVolume that uses the CSI driver's storage class. Here's an example:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv
spec:
  capacity:
    storage: 8Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: csi-gce-pd
  csi:
    driver: pd.csi.storage.gke.io
    fsType: ext4
    volumeAttributes:
      type: pd-standard
    volumeHandle: existing-disk-name

This PersistentVolume specification uses the GCE Persistent Disk CSI driver to create a persistent volume.

Conclusion

CSI Drivers provide a standardized interface for using different storage systems with Kubernetes. They bring about consistency, interoperability, and reliability to the process of managing storage in Kubernetes clusters.

profile
As a growing developer, I am continually expanding my skillset and knowledge, embracing new challenges and technologies

0개의 댓글