azurefile CSI driver for Kubernetes

WARNING: This driver is in ALPHA currently. Do NOT use this driver in a production environment in its current state.
About
This driver allows Kubernetes to use azure file volume, csi plugin name: file.csi.azure.com
Project Status
Status: Aplha
Container Images & CSI Compatibility:
| Azure File CSI Driver Version |
Image |
v0.3.0 |
v1.0.0 |
| v0.1.0-alpha |
mcr.microsoft.com/k8s/csi/azurefile-csi:v0.1.0-alpha |
yes |
no |
| v0.2.0-alpha |
mcr.microsoft.com/k8s/csi/azurefile-csi:v0.2.0-alpha |
no |
yes |
| master branch |
mcr.microsoft.com/k8s/csi/azurefile-csi:latest |
no |
yes |
Kubernetes Compatibility
| Azure File CSI Driver\Kubernetes Version |
1.12 |
1.13+ |
| v0.1.0-alpha |
yes |
yes |
| v0.2.0-alpha |
no |
yes |
| master branch |
no |
yes |
Driver parameters
Please refer to file.csi.azure.com driver parameters
storage class file.csi.azure.com parameters are compatible with built-in azurefile plugin
Prerequisite
Install azurefile CSI driver on a kubernetes cluster
Please refer to install azurefile csi driver
E2E Usage example
1. create a pod with csi azurefile driver mount on linux
Option#1: Azurefile Dynamic Provisioning
- Create an azurefile CSI storage class
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/storageclass-azurefile-csi.yaml
- Create an azurefile CSI PVC
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/pvc-azurefile-csi.yaml
Option#2: Azurefile Static Provisioning(use an existing azure file share)
- Use
kubectl create secret to create azure-secret with existing storage account name and key
kubectl create secret generic azure-secret --from-literal accountname=NAME --from-literal accountkey="KEY" --type=Opaque
- Create an azurefile CSI PV, download
pv-azurefile-csi.yaml file and edit sharename in volumeAttributes
wget https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/pv-azurefile-csi.yaml
vi pv-azurefile-csi.yaml
kubectl create -f pv-azurefile-csi.yaml
- Create an azurefile CSI PVC which would be bound to the above PV
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/pvc-azurefile-csi-static.yaml
2. validate PVC status and create an nginx pod
- make sure pvc is created and in
Bound status finally
watch kubectl describe pvc pvc-azurefile
- create a pod with azurefile CSI PVC
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/nginx-pod-azurefile.yaml
3. enter the pod container to do validation
- watch the status of pod until its Status changed from
Pending to Running and then enter the pod container
$ watch kubectl describe po nginx-azurefile
$ kubectl exec -it nginx-azurefile -- bash
root@nginx-azurefile:/# df -h
Filesystem Size Used Avail Use% Mounted on
overlay 30G 19G 11G 65% /
tmpfs 3.5G 0 3.5G 0% /dev
...
//f571xxx.file.core.windows.net/pvc-file-dynamic-e2ade9f3-f88b-11e8-8429-000d3a03e7d7 1.0G 64K 1.0G 1% /mnt/azurefile
...
In the above example, there is a /mnt/azurefile directory mounted as dysk filesystem.
Kubernetes Development
Please refer to development guide
Links