Aliyun Disk Kubernetes FlexVolume Driver
- Copy aliyun-disk binary to kubelet volume plugin directory. (
/usr/libexec/kubernetes/kubelet-plugins/volume/exec/pragkent.me~aliyun-disk
) - Add four env variables to kube-controller-manager:
- ALIYUN_ACCESS_KEY
- ALIYUN_ACCESS_SECRET
- ALIYUN_REGION
- ALIYUN_CLUSTER
To install, use go get
:
$ go get github.com/pragkent/aliyun-disk
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: myfrontend
image: nginx
volumeMounts:
- mountPath: /var/www/html
name: my-disk
volumes:
- name: my-disk
flexVolume:
driver: pragkent.me/aliyun-disk
fsType: ext4
options:
diskId: "d-12345"
apiVersion: v1
kind: PersistentVolume
metadata:
name: myvol
labels:
type: aliyundisk
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
flexVolume:
driver: pragkent.me/aliyun-disk
fsType: ext4
options:
diskId: "d-12345"
Deploy aliyundisk-provisioner on your cluster first.
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: ssd
provisioner: pragkent.me/aliyun-disk
parameters:
category: cloud_ssd
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: my-pvd-claim
spec:
accessModes:
- ReadWriteOnce
storageClassName: ssd
resources:
requests:
storage: 5Gi