minikube: StorageClass reclaimPolicy is being ignored
I created the following storage class called ‘standard-persist’ (using the ‘standard’ storage class as a template):
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
annotations:
storageclass.beta.kubernetes.io/is-default-class: "false"
labels:
addonmanager.kubernetes.io/mode: EnsureExists
name: standard-persist
provisioner: k8s.io/minikube-hostpath
reclaimPolicy: Retain
volumeBindingMode: Immediate
I then applied the following PVC:
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-db-data-storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: standard-persist
This ended up creating:
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc-db-data-storage Bound pvc-5a3887c3-4efc-11e9-8cda-0800271f16b7 1Gi RWO standard-persist 7s
$ kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-5a3887c3-4efc-11e9-8cda-0800271f16b7 1Gi RWO Delete Bound default/pvc-db-data-storage standard-persist 9s
As you can see the Reclaim Policy still shows as ‘Delete’ even though it should be ‘Retain’.
I can however workaround this problem by manually changing the Reclaim Policy of a PersistentVolume
My environment setup:
$ minikube version
minikube version: v0.35.0
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.4", GitCommit:"c27b913fddd1a6c480c229191a087698aa92f0b1", GitTreeState:"clean", BuildDate:"2019-03-01T23:34:27Z", GoVersion:"go1.12", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.4", GitCommit:"c27b913fddd1a6c480c229191a087698aa92f0b1", GitTreeState:"clean", BuildDate:"2019-02-28T13:30:26Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 17 (6 by maintainers)
/reopen
/reopen
Seems we are still hitting this issue.
Thank you for filing this!
This seems like a bug in @r2d4’s external-storage
https://github.com/kubernetes/minikube/blob/master/vendor/github.com/r2d4/external-storage/lib/controller/controller.go#L779.