The WordPress and MySQL images used in this example can be pulled from SWR. Therefore, the image pull failure (ErrImagePull) will not occur. If the application to be migrated is created from a private image, perform the following steps to update the image:
The image path is in the following format:
'swr.{Region}.otc.t-systems.com/{Organization name}/{Image name}:{Tag}'
kubectl edit deploy wordpress
After the cluster is migrated, the Service of the source cluster may fail to take effect. You can perform the following steps to update the Service. If ingresses are configured in the source cluster, connect the new cluster to ELB again after the migration. For details, see Using kubectl to Create an ELB Ingress.
kubectl edit svc wordpress
annotations: kubernetes.io/elb.class: union # Shared load balancer kubernetes.io/elb.id: 9d06a39d-xxxx-xxxx-xxxx-c204397498a3 # Load balancer ID, which can be queried on the ELB console. kubernetes.io/elb.subnet-id: f86ba71c-xxxx-xxxx-xxxx-39c8a7d4bb36 # ID of the cluster where the subnet resides kubernetes.io/session-affinity-mode: SOURCE_IP # Enable the sticky session based on the source IP address.
As the storage infrastructures of clusters may be different, storage volumes cannot be mounted to the target cluster. You can use either of the following methods to update the volumes:
Both update methods can be performed only before the application is restored in the target cluster. Otherwise, PV data resources may fail to be restored. In this case, use Velero to restore applications after the storage class update is complete.
Method 1: Creating a ConfigMap mapping
apiVersion: v1 kind: ConfigMap metadata: name: change-storageclass-plugin-config namespace: velero labels: app.kubernetes.io/name: velero velero.io/plugin-config: "true" velero.io/change-storage-class: RestoreItemAction data: {Storage class name01 in the source cluster}: {Storage class name01 in the target cluster} {Storage class name02 in the source cluster}: {Storage class name02 in the target cluster}
$ kubectl create -f change-storage-class.yaml configmap/change-storageclass-plugin-config created
Method 2: Creating a storage class with the same name
kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE csi-disk everest-csi-provisioner Delete Immediate true 3d23h csi-disk-topology everest-csi-provisioner Delete WaitForFirstConsumer true 3d23h csi-nas everest-csi-provisioner Delete Immediate true 3d23h csi-obs everest-csi-provisioner Delete Immediate false 3d23h csi-sfsturbo everest-csi-provisioner Delete Immediate true 3d23h
Storage Class |
Storage Resource |
---|---|
csi-disk |
EVS |
csi-disk-topology |
EVS with delayed binding |
csi-nas |
SFS |
csi-obs |
OBS |
csi-sfsturbo |
SFS Turbo |
kubectl get sc <storageclass-name> -o=yaml
Change the storage class name to the name used in the source cluster to call basic storage resources of the cloud.
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: creationTimestamp: "2021-10-18T06:41:36Z" name: <your_storageclass_name> # Use the name of the storage class used in the source cluster. resourceVersion: "747" selfLink: /apis/storage.k8s.io/v1/storageclasses/csi-obs uid: 4dbbe557-ddd1-4ce8-bb7b-7fa15459aac7 parameters: csi.storage.k8s.io/csi-driver-name: obs.csi.everest.io csi.storage.k8s.io/fstype: obsfs everest.io/obs-volume-type: STANDARD provisioner: everest-csi-provisioner reclaimPolicy: Delete volumeBindingMode: Immediate
kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE pvc Bound pvc-4c8e655a-1dbc-4897-ae6c-446b502f5e77 5Gi RWX local 13s
In this example, the database is a local MySQL database and does not need to be reconfigured after the migration.
kubectl edit deploy wordpress
Set the environment variables in the env field.