|
4 | 4 | // * migration_toolkit_for_containers/advanced-migration-options-mtc.adoc
|
5 | 5 |
|
6 | 6 | [id="migration-state-migration-cli_{context}"]
|
7 |
| -= Migrating an application's state |
| 7 | += State migration |
8 | 8 |
|
9 |
| -You can perform repeatable, state-only migrations by selecting specific persistent volume claims (PVCs). During a state migration, {mtc-full} ({mtc-short}) copies persistent volume (PV) data to the target cluster. PV references are not moved. The application pods continue to run on the source cluster. |
| 9 | +You can perform repeatable, state-only migrations by using {mtc-full} ({mtc-short}) to migrate persistent volume claims (PVCs) that constitute an application's state. Persistent volume (PV) data is copied to the target cluster. The PV references are not moved. The application pods continue to run on the source cluster. |
| 10 | + |
| 11 | +You can perform a one-time migration of Kubernetes objects that constitute an application's state. |
10 | 12 |
|
11 | 13 | If you have a CI/CD pipeline, you can migrate stateless components by deploying them on the target cluster. Then you can migrate stateful components by using {mtc-short}.
|
12 | 14 |
|
13 |
| -You can use state migration to migrate namespaces within the same cluster. |
| 15 | +You can perform a state migration between clusters or within the same cluster. |
14 | 16 |
|
15 | 17 | [IMPORTANT]
|
16 | 18 | ====
|
17 |
| -Do not use state migration to migrate namespaces between clusters. Use stage or cutover migration instead. |
| 19 | +State migration migrates only the components that constitute an application's state. If you want to migrate an entire namespace, use stage or cutover migration. |
18 | 20 | ====
|
19 |
| - |
20 |
| -You can migrate PV data from the source cluster to PVCs that are already provisioned in the target cluster by mapping PVCs in the `MigPlan` CR. This ensures that the target PVCs of migrated applications are synchronized with the source PVCs. |
21 |
| - |
22 |
| -You can perform a one-time migration of Kubernetes objects that store application state. |
23 |
| - |
24 |
| -[id="excluding-pvcs_{context}"] |
25 |
| -== Excluding persistent volume claims |
26 |
| - |
27 |
| -You can exclude persistent volume claims (PVCs) by adding the `spec.persistentVolumes.pvc.selection.action` parameter to the `MigPlan` custom resource (CR) after the persistent volumes (PVs) have been discovered. |
28 |
| - |
29 |
| -.Prerequisites |
30 |
| - |
31 |
| -* `MigPlan` CR with discovered PVs. |
32 |
| - |
33 |
| -.Procedure |
34 |
| - |
35 |
| -* Add the `spec.persistentVolumes.pvc.selection.action` parameter to the `MigPlan` CR and set its value to `skip`: |
36 |
| -+ |
37 |
| -[source,yaml] |
38 |
| ----- |
39 |
| -apiVersion: migration.openshift.io/v1alpha1 |
40 |
| -kind: MigPlan |
41 |
| -metadata: |
42 |
| - name: <migplan> |
43 |
| - namespace: openshift-migration |
44 |
| -spec: |
45 |
| -... |
46 |
| - persistentVolumes: |
47 |
| - - capacity: 10Gi |
48 |
| - name: <pv_name> |
49 |
| - pvc: |
50 |
| -... |
51 |
| - selection: |
52 |
| - action: skip <1> |
53 |
| ----- |
54 |
| -<1> `skip` excludes the PVC from the migration plan. |
55 |
| - |
56 |
| -[id="mapping-pvcs_{context}"] |
57 |
| -== Mapping persistent volume claims |
58 |
| - |
59 |
| -You can map persistent volume claims (PVCs) by updating the `spec.persistentVolumes.pvc.name` parameter in the `MigPlan` custom resource (CR) after the persistent volumes (PVs) have been discovered. |
60 |
| - |
61 |
| -.Prerequisites |
62 |
| - |
63 |
| -* `MigPlan` CR with discovered PVs. |
64 |
| - |
65 |
| -.Procedure |
66 |
| - |
67 |
| -* Update the `spec.persistentVolumes.pvc.name` parameter in the `MigPlan` CR: |
68 |
| -+ |
69 |
| -[source,yaml] |
70 |
| ----- |
71 |
| -apiVersion: migration.openshift.io/v1alpha1 |
72 |
| -kind: MigPlan |
73 |
| -metadata: |
74 |
| - name: <migplan> |
75 |
| - namespace: openshift-migration |
76 |
| -spec: |
77 |
| -... |
78 |
| - persistentVolumes: |
79 |
| - - capacity: 10Gi |
80 |
| - name: <pv_name> |
81 |
| - pvc: |
82 |
| - name: <source_pvc>:<destination_pvc> <1> |
83 |
| ----- |
84 |
| -<1> Specify the PVC on the source cluster and the PVC on the destination cluster. If the destination PVC does not exist, it will be created. You can use this mapping to change the PVC name during migration. |
85 |
| - |
86 |
| -[id="migrating-kubernetes-objects_{context}"] |
87 |
| -== Migrating Kubernetes objects |
88 |
| - |
89 |
| -You can perform a one-time migration of Kubernetes objects that constitute an application's state. |
90 |
| - |
91 |
| -[NOTE] |
92 |
| -==== |
93 |
| -After migration, the `closed` parameter of the `MigPlan` CR is set to `true`. You cannot create another `MigMigration` CR for this `MigPlan` CR. |
94 |
| -==== |
95 |
| - |
96 |
| -You add Kubernetes objects to the `MigPlan` CR by using the following options: |
97 |
| - |
98 |
| -* Adding the Kubernetes objects to the `includedResources` section. |
99 |
| -* Using the `labelSelector` parameter to reference labeled Kubernetes objects. |
100 |
| - |
101 |
| -If you set both parameters, the label is used to filter the included resources, for example, to migrate `Secret` and `ConfigMap` resources with the label `app: frontend`. |
102 |
| - |
103 |
| -.Procedure |
104 |
| - |
105 |
| -* Update the `MigPlan` CR: |
106 |
| -+ |
107 |
| -[source,yaml] |
108 |
| ----- |
109 |
| -apiVersion: migration.openshift.io/v1alpha1 |
110 |
| -kind: MigPlan |
111 |
| -metadata: |
112 |
| - name: <migplan> |
113 |
| - namespace: openshift-migration |
114 |
| -spec: |
115 |
| - includedResources: <1> |
116 |
| - - kind: <Secret> |
117 |
| - group: "" |
118 |
| - - kind: <ConfigMap> |
119 |
| - group: "" |
120 |
| -... |
121 |
| - labelSelector: |
122 |
| - matchLabels: |
123 |
| - <app: frontend> <2> |
124 |
| ----- |
125 |
| -<1> Specify the `kind` and `group` of each resource. |
126 |
| -<2> Specify the label of the resources to migrate. |
0 commit comments