Score:0

Migrate Kubernetes storage from vSphere to NFS with StatefulSets

cl flag

I'm trying to move all my persistent volumes from vSphere to NFS, I managed to do it for many applications that use Deployment kind. All I have to do is:

  • Mount the NFS volume to a different path (/tmp for example)
  • Copy the data from vSphere volume to NFS volume (using cp command in the pod)
  • Swap the volumes names in the Deployment definition and finally get rid of the vSphere volume

Now, I have StatefulSets with volumes to be mounted on each pod. This approach won't work since Kubernetes wont let you modify the field spec.volumeClaimTemplates in StatefulSets definition.

I have 3 replicas and the vSphere volumes were provisioned dynamically, but I have now 3 NFS volumes that I created manually and I want to migrate the existing data to them.

Any idea how to perform this operation?

mozello avatar
cn flag
Hello abdelhalimresu, could you add sts spec.volumeClaimTemplates section to the question? How did you set up a Kubernetes cluster (cloud, on-premise, k8s version)?
Score:0
jp flag

Have you tried using velero: it's Vmware tool that lets you back up and restore your Kubernetes cluster resources and persistent volumes. You can run Velero with a public cloud platform or on-premises. Velero lets you:

  • Take backups of your cluster and restore in case of loss.
  • Migrate cluster resources to other clusters.
  • Replicate your production cluster to development and testing clusters.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.