You can migrate in-tree vSphere volumes to vSphere Container Storage Plug-in. After you migrate the in-tree vSphere volumes, vSphere Container Storage Plug-in performs all subsequent operations on migrated volumes.
vSphere Container Storage Plug-in and CNS provide functionality that is not available with the in-tree vSphere volume plug-in. For information, see Supported Kubernetes Functionality and vSphere Functionality Supported by vSphere Container Storage Plug-in.
- Migration of in-tree vSphere volumes to CSI does not work with Kubernetes version 1.29.0. See https://github.com/kubernetes/kubernetes/issues/122340.
Use Kubernetes version 1.29.1 or later.
- Kubernetes will deprecate the in-tree vSphere volume plug-in, and it will be removed in the future Kubernetes releases. Volumes provisioned using the vSphere in-tree plug-in will not get additional new features supported by the vSphere Container Storage Plug-in.
- Kubernetes provides a seamless procedure to help migrate in-tree vSphere volumes to a vSphere Container Storage Plug-in. After you migrate the in-tree vSphere volumes vSphere Container Storage Plug-in, all subsequent operations on migrated volumes are performed by the vSphere Container Storage Plug-in. The migrated vSphere volume will not get additional capabilities supported by vSphere Container Storage Plug-in.
Considerations for Migration of In-Tree vSphere Volumes
When you prepare to use the vSphere Container Storage Plug-in migration, consider the following items.
- vSphere version 7.0 p07 and vSphere version 8.0 Update 2 or later is recommended for In-tree vSphere volume migration to vSphere Container Storage Plug-in.
- vSphere Container Storage Plug-in migration is released as a
Beta
feature in Kubernetes 1.19. For more information, see Release note announcement. - If you plan to use CSI version 3.0 or 3.1 for migrated volumes, use the latest patch version 3.0.3 or version 3.1.1. These patch versions include the fix for the issue https://github.com/kubernetes-sigs/vsphere-csi-driver/issues/2534. This issue occurs when both CSI migration and list-volumes functionality are enabled.
- Kubernetes 1.19 release deprecates vSAN raw policy parameters for the in-tree vSphere volume plug-in. These parameters will be removed in a future release. For more information, see Deprecation Announcement.
- The following vSphere in-tree StorageClass parameters are not supported after you enable migration:
hostfailurestotolerate
forceprovisioning
cachereservation
diskstripes
objectspacereservation
iopslimit
diskformat
- You cannot rename or delete the storage policy consumed by an in-tree vSphere volume. Volume migration requires the original storage policy used for provisioning the volume to be present on vCenter Server for registration of volume as a container volume in vSphere.
- Do not rename the datastore consumed by in-tree vSphere volume. Volume migration relies on the original datastore name present on the volume source for registration of volume as container volume in vSphere.
- Make sure to add the following annotations before enabling migration for statically created vSphere in-tree Persistent Volume Claims, and Persistent Volumes. Statically provisioned in-tree vSphere volumes cannot be migrated to the vSphere Container Storage Plug-in without adding these annotations. This also applies to new static in-tree PVs and PVCs created after you enable migration.
Annotation on PV:
annotations: pv.kubernetes.io/provisioned-by: kubernetes.io/vsphere-volume
Annotation on PVC:
annotations: volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/vsphere-volume
- After migration, if you use vSphere releases earlier than 8.0 Update 1, the only supported value for
diskformat
parameter is thin. Volumes created before the migration with the disk formateagerzeroedthick
orzeroedthick
are migrated to CSI.Starting with vSphere 8.0 Update 1, you can use storage policies with thick volume requirement to migrate
eagerzeroedthick
orzeroedthick
volumes. For more information, see Create a VM Storage Policy for VMFS Datastore in the vSphere Storage documentation. - vSphere Container Storage Plug-in does not support raw vSAN policy parameters. After you enable the migration, vSphere Container Storage Plug-in fails the volume creation activity when you request a new volume using in-tree provisioner and vSAN raw policy parameters.
- The vSphere Container Storage Plug-in migration requires a compatible version of vSphere. For information, see Supported Kubernetes Functionality.
- vSphere Container Storage Plug-in does not support formatting volumes with the Windows file system. In-tree vSphere volumes migrated using the Windows file system cannot be used with the vSphere Container Storage Plug-in.
- In-tree vSphere volume plug-in relies on the name of the datastore set on the PVs source. After you enable migration, do not enable Storage DRS or vMotion. If Storage DRS moves a disk from one datastore to another, further volume operations might break.
- If you use zone and region aware in-tree deployments, upgrade to vSphere Container Storage Plug-in version 2.4.1 and later.
Before installing vSphere Container Storage Plug-in, add the following section to the vSphere secret configuration.
Kubernetes Version
In-Tree vSphere Secret Configuration
vSphere Container Storage Plug-in Secret Configuration
Sample Labels on vSphere Container Storage Plug-in Nodes after Installation
1.21.x and below
Earliest version is 1.19
[Labels] region = k8s-region zone = k8s-zone
[Labels] region = k8s-region zone = k8s-zone
Name: k8s-node-0179 Roles: <none> Labels: failure-domain.beta.kubernetes.io/region=region-1 failure-domain.beta.kubernetes.io/zone=zone-a Annotations: ....
1.22.x and 1.23.x
If all of your existing PVs have the GA label, use this approach.
[Labels] region = k8s-region zone = k8s-zone
[Labels] region = k8s-region zone = k8s-zone [TopologyCategory "k8s-region"] Label = "topology.kubernetes.io/region" [TopologyCategory "k8s-zone"] Label = "topology.kubernetes.io/zone"
Name: k8s-node-0179 Roles: <none> Labels: topology.kubernetes.io/region=region-1 topology.kubernetes.io/zone=zone-a Annotations: ....
1.24.x
If the Kubernetes cluster has PVs with either beta or GA labels, you can migrate to vSphere Container Storage Plug-in using the following configuration.
[Labels] region = k8s-region zone = k8s-zone
[Labels] region = k8s-region zone = k8s-zone [TopologyCategory "k8s-region"] Label = "topology.csi.vmware.com/region" [TopologyCategory "k8s-zone"] Label = "topology.csi.vmware.com/zone"
Name: k8s-node-0179 Roles: <none> Labels: topology.kubernetes.io/region=region-1 topology.kubernetes.io/zone=zone-a Annotations: ....
For information about deployments with topology, see Deploy vSphere Container Storage Plug-in with Topology.
- vSphere Container Storage Plug-in version 3.0 provides a new migration-datastore-url parameter in the vSphere configuration secret. The parameter allows to honor the default datastore feature of the in-tree vSphere plug-in.
Enable Migration of In-Tree vSphere Volumes to vSphere Container Storage Plug-in
Migrate the in-tree vSphere volumes to vSphere Container Storage Plug-in.
Prerequisites
Make sure to use compatible versions of vSphere and Kubernetes. See Supported Kubernetes Functionality.