I learned that a
StatefulSet will look for PVCs with specific names. I figured this out from the documentation at https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#limitations which says:
The storage for a given Pod must either be provisioned by a
PersistentVolume Provisioner based on the requested storage class, or
pre-provisioned by an admin.
And through experimentation I discovered that pre-provisioning just meant creating
PersistentVolumeClaims with the expected names.
I was able to restore an EBS snapshot to a volume, create a
PersistentVolume directly referencing the restored volume id, then create a
PersistentVolumeClaim with the correct name. So for instance this mongo installation expects volumes named like
datadir-pii-mongodb-replicaset-[0-2] and after restoring the EBS snapshot to a volume I use the following yaml:
Be careful about availability zones. Since I spanned 3 zones I needed to restore the three snapshots into separate zones and make sure the
PersistentVolume spec reflected that.