This document shows how to migrate a vSphere datastore to Storage Policy Based Management (SPBM).
1.29: Preview
1.16 and earlier: Not available
Context
There are four places where you can specify a datastore in cluster configuration files:
Admin cluster vCenter.datastore
User cluster vCenter.datastore
User cluster masterNode.vsphere.datastore
User cluster nodePools[i].vsphere.datastore
The inheritance for these fields is as follows:
adminCluster.vCenter.datastore -> userCluster.vCenter.datastore -> (userCluster.masterNode.vsphere.datastore and userCluster.nodePools[i].vsphere.datastore
Examples:
If
userCluster.vCenter.datastore
is empty, it inherits the value fromadminCluster.vCenter.datastore
.If
userCluster.nodePools[i].vsphere.datastore
is empty, it inherits the value fromuserCluster.vCenter.datastore
.
Similarly, there are four places to specify a storage policy:
Admin cluster vCenter.storagePolicyName
User cluster vCenter.storagePolicyName
User cluster masterNode.vsphere.storagePolicyName
User cluster nodePools[i].vsphere.storagePolicyName
The inheritance for the storagePolicyName
fields is the same as it is for the
datastore
fields.
Before you begin
This is a one-way migration. We don't support migrating back to the previous state.
Perform a migration for a user cluster
Get the current cluster configuration:
gkectl get-config cluster --kubeconfig ADMIN_CLUSTER_KUBECONFIG \ --cluster-name USER_CLUSTER_NAME \ --output-dir ./gen-files
Replace the following:
ADMIN_CLUSTER_KUBECONFIG: the path of the kubeconfig file for the admin cluster
USER_CLUSTER_NAME: the name of the user cluster
In
./gen-files
, locateuser-cluster.yaml
.For more information about getting the configuration file, see Generate configuration files from a cluster.
To perform a migration for one of the datastore fields:
- Set the
datastore
field to the empty string. - Specify a value for
storagePolicyName
. - Run
gkectl update
.
Here's an example of performing a migration for
masterNode.vsphere.datastore
:Adjust the recently generated
user-cluster.yaml
:masterNode.vsphere.datastore="" masterNode.vsphere.masterNode.vsphere.storagePolicyName="control-plane-storage-policy"
Update the user cluster:
gkectl update cluster --kubeconfig ADMIN_CLUSTER_KUBECONFIG --config USER_CLUSTER_CONFIG
Replace the following:
ADMIN_CLUSTER_KUBECONFIG: the path of the admin cluster kubeconfig file
USER_CLUSTER_CONFIG: the path of
user-cluster.yaml
that you generated in the previous step.
- Set the
Notes
If you create a new node pool after a migration, the new pool follows the rules of inheritance according the updated cluster.
For example, suppose you migrated vCenter.datastore
to a storage policy.
Now if you create a new node pool and leave both
nodePools[i].vsphere.datastore
and nodePools[i].vsphere.storagePolicyName
empty, the new node pool inherits the storage policy specified in
vCenter.storagePolicyName
.