How can I install KOTS with a custom storageClass?

Question:
My cluster doesn’t have a default storageClass defined, and I don’t have access to cluster-admin privileges to create one - how can I install KOTS and specify an alternative storageClassName for KOTS’ PVCs?

Answer:
We can use the kots admin-console generate-manifests subcommand to generate the YAML manifests for the admin console and edit KOTS’ PVC definition. However, the kots upgrade command will erase the modification since it expects the storageClassName to be default. To upgrade effectively, repeat the process of using kots admin-console generate-manifests to create the manifest YAML files, edit the PVC definition, and apply the updated manifests to the cluster.

After generating the manifests, add a PersistentVolumeClaim for the kotsadm-postgres volume that uses the alternative StorageClass:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: kotsadm-postgres
spec:
   accessModes:
     - ReadWriteOnce
   storageClassName: my-storageclass 	
   resources:
       requests:
           storage: 2Gi

and if you are using MinIO, add a second PVC for kotsadm-minio:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: kotsadm-minio
spec:
   accessModes:
     - ReadWriteOnce
   storageClassName: my-storageclass 	
   resources:
       requests:
           storage: 10Gi

After writing the additional PVCs, deploy these to the cluster prior to deploying KOTS itself.