We're requesting persistence on kubernetes using persistence volume claim.
Currently, we're setting storage class
using volume.beta.kubernetes.io/storage-class
annotation:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: vault-file-backend-volumeclaim
annotations:
volume.beta.kubernetes.io/storage-class: heketi
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
However, we've realized that exists an spec.storageClassName
field, we don't know what's it for...
Could we remove volume.beta.kubernetes.io/storage-class
annotation by setting spec.storageClassName
?
Yes, you should opt for storageClassName
, because the annotation will be deprecated in the future, as state in kubernetes.io:
In the past, the annotation
volume.beta.kubernetes.io/storage-class
was used instead of the storageClassName attribute. This annotation is still working, however it will become fully deprecated in a future Kubernetes release.
So your YML file will be the following:
storageclass.yml
:
apiVersion: storage.k8s.io/v1beta1
kind: StorageClass
metadata:
name: heketi
provisioner: kubernetes.io/glusterfs
parameters:
resturl: [...]
restuser: [...]
restuserkey: [...]
pv.yml
:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: vault-file-backend-volumeclaim
spec:
storageClassName: heketi
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi