According to the documentation https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/ if wi want to change the default Storage Class we should patch it.
Template to create new Storage Class
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: encrypted
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp2
fsType: ext4
encrypted: true
I have tried to add to the template:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: gp2
annotations:
storageclass.kubernetes.io/is-default-class: "false"
provisioner: kubernetes.io/aws-ebs
And got an error: gp2 already exist
How to patch/update default Storage Class (make it non-default) with Helm template?
Helm can only manage resources created by itself, and you are trying to alter an already existing resource. You can either: