this doc describes how to migrate a pks installation and any other bosh managed vms to a new vsphere cluster.
Warning: migrating clusters can cuase issues if the new cluster does not have the same network and storage attached, be sure to validate before doing this.you can vmotion a test vm to validate
Note: if you are planning on delete the old cluster afterward make sure you move the opsmanager over to the new cluster using vmotion.
- download the om om cli
- set OM cli env variables
export OM_TARGET=<opsman fqdn>
export OM_USERNAME=admin
export OM_SKIP_SSL_VALIDATION=true
export OM_PASSWORD=<password>
first we need to add our new cluster(s) to the AZs and apply changes so that bosh is aware of the new clusters.
- login to opsman and go into the director tile
- click on "Create Availability Zones"
- for each AZ that you want to change the underlying vsphere cluster for add a new cluster to that az by clicking the "add cluster" button and filling in your details.
- Apply changes.
We need to use the api to put opsman into advanced mode. the easiest way to do this is to use the om cli and use om curl
.
if you have not done the setup above do that now.
- run the
om curl
command to change into advanced mode.
om curl -p /api/v0/staged/infrastructure/locked -x PUT --data '{"locked" : "false"}' -H "Content-Type: application/json"
- check the status, it should be false
om curl -p /api/v0/staged/infrastructure/locked
this can only be done via the api when in advanced mode.
- get a list of all of azs and clusters
om curl -p /api/v0/staged/director/availability_zones
you should recieve an output that looks something like this.
{
"availability_zones": [
{
"name": "az1",
"guid": "b64536b7d146fb18042e",
"iaas_configuration_guid": "c7d392865fad1fa8168b",
"clusters": [
{
"guid": "23a52683cec52225ff05",
"cluster": "old-cluster",
"resource_pool": "old",
"host_group": null,
"drs_rule": "MUST"
},
{
"guid": "53a5283cef52226ft05",
"cluster": "new-cluster",
"resource_pool": "new",
"host_group": null,
"drs_rule": "MUST"
}
]
}
]
}
- modify the json that was output to remove the old cluster from the list
be sure to keep the GUID the same on the az and cluster
you should end up with something like this:
{
"availability_zones": [
{
"name": "az1",
"guid": "b64536b7d146fb18042e",
"iaas_configuration_guid": "c7d392865fad1fa8168b",
"clusters": [
{
"guid": "53a5283cef52226ft05",
"cluster": "new-cluster",
"resource_pool": "new",
"host_group": null,
"drs_rule": "MUST"
}
]
}
]
}
- update opsman with the api to overwrite the azs
you will need to replace the json after the -d
below with your modified json from the previous step.
om curl -p "/api/v0/staged/director/availability_zones" \
-x PUT \
-H "Content-Type: application/json" \
-d '{
"availability_zones": [
{
"name": "az1",
"guid": "b64536b7d146fb18042e",
"iaas_configuration_guid": "c7d392865fad1fa8168b",
"clusters": [
{
"guid": "53a5283cef52226ft05",
"cluster": "new-cluster",
"resource_pool": "new",
"host_group": null,
"drs_rule": "MUST"
}
]
}
]
}'
- go into the director tile under "director config" and check the "recreate all VMs" box. we need to do this so we are certain bosh will move everything"
- if you are using PKS be sure the "upgrade all clusters" errand is checked.
- Click "apply changes"
at this point all the VMs should start recreating in the new cluster.