|
1 | 1 | # Migrating Existing Installations to HelmChart v2 |
2 | 2 |
|
3 | | -This topic provides guidance for migrating existing installations that were deployed with the HelmChart custom resource `kots.io/v1beta1` with `useHelmInstall: true` to use `kots.io/v1beta2` instead. |
| 3 | +This topic describes how to migrate existing Replicated KOTS installations to the KOTS HelmChart `kots.io/v1beta2` (HelmChart v2) installation method, without having to reinstall the application. It also includes information about how to support both HelmChart v1 and HelmChart v2 installations from a single release, and lists frequently-asked questions (FAQs) related to migrating to HelmChart v2. |
4 | 4 |
|
5 | | -## Overview |
| 5 | +## Migrate to HelmChart v2 |
6 | 6 |
|
7 | | -The HelmChart custom resource `kots.io/v1beta1` is deprecated and is not recommended for new installations. Existing installations that were installed with `kots.io/v1beta1` and `useHelmInstall: true` can be migrated to `kots.io/v1beta2` without needing to reinstall the application. For information about how to support installation with the `kots.io/v1beta2` HelmChart custom resource, including rewriting images, injecting pull secrets, and adding backup labels, see [Configuring the HelmChart Custom Resource v2](helm-native-v2-using). |
| 7 | +### Requirements |
8 | 8 |
|
9 | | -### `useHelmInstall: false` Limitation |
| 9 | +* The HelmChart v2 custom resource is supported with KOTS v1.99.0 and later. If any of your customers are running a version of KOTS earlier than v1.99.0, see [Support Customers on KOTS Versions Earlier Than v1.99.0](#support-both-v1-v2) below for more information about how to support both HelmChart v1 and HelmChart v2 installations from the same release. |
10 | 10 |
|
11 | | -To migrate an existing installation from `kots.io/v1beta1` with `useHelmInstall: false` to `kots.io/v1beta2`, reach out to your Replicated account representative in Slack or over email. |
| 11 | +* The Helm `--take-ownership` flag is supported with KOTS v1.124.0 and later. |
12 | 12 |
|
13 | | -## How to Migrate Existing Installations |
| 13 | +* The `kots.io/keep` annotation is supported with KOTS v1.122.0 and later. |
14 | 14 |
|
15 | | -The HelmChart custom resource version `kots.io/v1beta2` is available only for installations that use KOTS v1.99.0 or later. To support existing users that have not yet upgraded to KOTS v1.99.0 or later, Replicated recommends that you include both a `kots.io/v1beta2` and a `kots.io/v1beta1` (with `useHelmInstall: true`) HelmChart custom resource for each Helm chart in your release. This allows you to support both installation methods from the same release. |
| 15 | +### Migrate From HelmChart v1 with `useHelmInstall: true` |
16 | 16 |
|
17 | | -When you include both versions in a single release for the same Helm chart, installations with KOTS v1.98.0 or earlier use `kots.io/v1beta1`. Installations with KOTS v1.99.0 or later use `kots.io/v1beta2`. |
| 17 | +To migrate existing installations from HelmChart v1 with `useHelmInstall: true` to HelmChart v2: |
18 | 18 |
|
19 | | -After all customer environments where the Helm chart was previously installed with `kots.io/v1beta1` and `useHelmInstall: true` are upgraded to KOTS v1.99.0 or later, you can remove version `kots.io/v1beta1` of the HelmChart custom resource from your releases. |
| 19 | +1. In a development environment, install an application release using the KOTS HelmChart v1 with `useHelmInstall: true` method. You will use this installation to test the migration to HelmChart v2. |
| 20 | + |
| 21 | +1. Create a new release containing your application files. |
| 22 | + |
| 23 | +1. For each Helm chart in the release, find the corresponding HelmChart custom resource and update `apiVersion` to `kots.io/v1beta2`. Then update it to rewrite images, inject image pull secrets, and add backup labels. See [Configuring the HelmChart Custom Resource v2](helm-native-v2-using). |
| 24 | + |
| 25 | +1. Promote the release to an internal-only channel that your team uses for testing. |
| 26 | + |
| 27 | +1. In your development environment, log in to the Admin Console and confirm that you can upgrade to the new HelmChart v2 release. |
| 28 | + |
| 29 | +1. When you are done testing, promote the release to one or more of your customer-facing channels. Customers can follow the standard upgrade process in the Admin Console to update their instance. |
| 30 | + |
| 31 | +### Migrate From HelmChart v1 with `useHelmInstall: false` |
| 32 | + |
| 33 | +This section describes how to migrate existing HelmChart v1 installations with `useHelmInstall: false`. |
| 34 | + |
| 35 | +:::note |
| 36 | +When the `useHelmInstall` field is _not_ set in the HelmChart custom resource, `false` is the default value. |
| 37 | +::: |
| 38 | + |
| 39 | +These migration steps ensure that KOTS does not uninstall any resources that were previously deployed without Helm, and that Helm takes ownership of these existing resources. |
| 40 | + |
| 41 | +To migrate existing installations from HelmChart v1 and `useHelmInstall: false` to HelmChart v2: |
| 42 | + |
| 43 | +1. Create a new release containing your application files: |
| 44 | + |
| 45 | + 1. In the release, for any resources defined in Kubernetes manifests or in your Helm `templates` that were previously installed with HelmChart v1 and `useHelmInstall: false`, add the `kots.io/keep` annotation. The `kots.io/keep` annotation prevents KOTS from uninstalling these resources when upgrading using the HelmChart v2 method. |
| 46 | + |
| 47 | + **Example:** |
| 48 | + |
| 49 | + ```yaml |
| 50 | + apiVersion: apps/v1 |
| 51 | + kind: Statefulset |
| 52 | + metadata: |
| 53 | + name: postgresql |
| 54 | + # Add the kots.io/keep annotation |
| 55 | + annotations: |
| 56 | + kots.io/keep: "true" |
| 57 | + ``` |
| 58 | + |
| 59 | + 1. Save the release. |
| 60 | + |
| 61 | +1. Create another new release: |
| 62 | +
|
| 63 | + 1. For each Helm chart in the release, find the corresponding HelmChart custom resource and update `apiVersion` to `kots.io/v1beta2`. Then update it to rewrite images, inject image pull secrets, and add backup labels. See [Configuring the HelmChart Custom Resource v2](helm-native-v2-using). |
| 64 | + |
| 65 | + 1. In the HelmChart custom resource, under the `helmUpgradeFlags` field, add the `--take-ownership` flag: |
| 66 | + |
| 67 | + ```yaml |
| 68 | + # HelmChart v2 |
| 69 | + apiVersion: kots.io/v1beta2 |
| 70 | + kind: HelmChart |
| 71 | + metadata: |
| 72 | + name: samplechart |
| 73 | + spec: |
| 74 | + helmUpgradeFlags: |
| 75 | + - --take-ownership |
| 76 | + ``` |
| 77 | + |
| 78 | + When the `--take-ownership` upgrade flag is enabled, Helm automatically takes ownership of resources that were previously deployed without Helm. |
| 79 | + |
| 80 | + 1. Save the release. |
| 81 | + |
| 82 | +1. Test the migration process: |
| 83 | + |
| 84 | + 1. Promote the first release to an internal-only channel that your team uses for testing. |
| 85 | + |
| 86 | + 1. In a development environment, install the first release. |
| 87 | + |
| 88 | + 1. Promote the second release to the same channel. |
| 89 | + |
| 90 | + 1. In your development environment, access the Admin Console to upgrade to the second release. |
| 91 | + |
| 92 | +1. When you are done testing, promote the first release to one or more of your customer-facing channels. Replicated recommends that you mark the release as required by enabling **Prevent this release from being skipped during upgrades**. For more information about required releases, see [Properties](/vendor/releases-about#properties) in _About Channels and Releases_. |
| 93 | + |
| 94 | +1. Promote the second release to the same customer-facing channel(s). Replicated recommends that you mark the release as required by enabling **Prevent this release from being skipped during upgrades**. |
| 95 | + |
| 96 | +1. Instruct customers to migrate by first upgrading to the release where the `kots.io.keep` annotation is applied to your resources, then upgrading to the release with HelmChart v2. |
| 97 | + |
| 98 | +1. In subsequent releases, remove the `--take-ownership` flag from the `helmUpgradeFlags` field and remove the `kots.io/keep` annotation from resources in your Helm templates. |
| 99 | + |
| 100 | +### Migrate From Standard Kubernetes Manifests |
| 101 | + |
| 102 | +This section describes how to migrate existing KOTS installations of applications that were previously packaged as standard Kubernetes manifests and are now packaged as one or more Helm charts. This migration path involves performing two upgrades to ensure that KOTS does not uninstall any resources that were adopted into Helm charts, and that Helm can take ownership of resources that were previously deployed without Helm. |
| 103 | + |
| 104 | +To migrate applications that were previously packaged as standard Kubernetes manifests: |
| 105 | + |
| 106 | +1. Create a new release containing the Kubernetes manifests for your application: |
| 107 | + |
| 108 | + 1. For each of the application manifests in the release, add the `kots.io/keep` annotation. The `kots.io/keep` annotation prevents KOTS from uninstalling resources that were previously installed without Helm when upgrading using the HelmChart v2 method. |
| 109 | + |
| 110 | + **Example:** |
| 111 | + |
| 112 | + ```yaml |
| 113 | + apiVersion: apps/v1 |
| 114 | + kind: Statefulset |
| 115 | + metadata: |
| 116 | + name: postgresql |
| 117 | + annotations: |
| 118 | + kots.io/keep: "true" |
| 119 | + ``` |
| 120 | + |
| 121 | + 1. Save the release. |
| 122 | + |
| 123 | +1. Create another new release: |
| 124 | + |
| 125 | + 1. In the release, add your application Helm chart(s). Remove the application manifests for resources that were adopted into the Helm chart(s). |
| 126 | + |
| 127 | + 1. For each Helm chart in the release, add a corresponding KOTS HelmChart custom resource with `apiVersion` set to `kots.io/v1beta2`. Configure the resource to rewrite images, inject image pull secrets, and add backup labels. See [Configuring the HelmChart Custom Resource v2](helm-native-v2-using). |
| 128 | + |
| 129 | + 1. In the HelmChart custom resource, under the `helmUpgradeFlags` field, add the `--take-ownership` flag: |
| 130 | + |
| 131 | + ```yaml |
| 132 | + # HelmChart v1 beta2 |
| 133 | + apiVersion: kots.io/v1beta2 |
| 134 | + kind: HelmChart |
| 135 | + metadata: |
| 136 | + name: samplechart |
| 137 | + spec: |
| 138 | + helmUpgradeFlags: |
| 139 | + - --take-ownership |
| 140 | + ``` |
| 141 | + |
| 142 | + When the `--take-ownership` upgrade flag is enabled, Helm automatically takes ownership of resources that were previously deployed without Helm. |
| 143 | + |
| 144 | + 1. Save the release. |
| 145 | + |
| 146 | +1. Test the migration process: |
| 147 | + |
| 148 | + 1. Promote the first release to an internal-only channel that your team uses for testing. |
| 149 | + |
| 150 | + 1. In a development environment, install the first release. |
| 151 | + |
| 152 | + 1. Promote the second release to the same channel. |
| 153 | + |
| 154 | + 1. In your development environment, access the Admin Console to upgrade to the second release. Upgrading to the second release migrates the installation to HelmChart v2. |
| 155 | + |
| 156 | +1. After you are done testing the migration process, promote the first release containing your application manifests with the `kots.io/keep` annotation to one or more customer-facing channels. Replicated recommends that you mark the release as required by enabling **Prevent this release from being skipped during upgrades**. For more information about required releases, see [Properties](/vendor/releases-about#properties) in _About Channels and Releases_. |
| 157 | + |
| 158 | +1. Promote the second release containing your Helm chart(s) to the same channels. Replicated recommends that you mark the release as required by enabling **Prevent this release from being skipped during upgrades**. |
| 159 | + |
| 160 | +1. Instruct customers to migrate by first upgrading to the release containing the standard manifests, then upgrading to the release packaged with Helm. |
| 161 | + |
| 162 | +1. In subsequent releases, remove the `--take-ownership` flag from the `helmUpgradeFlags` field and remove the `kots.io/keep` annotation from resources in your Helm templates. |
| 163 | + |
| 164 | +## Support Customers on KOTS Versions Earlier Than v1.99.0 {#support-both-v1-v2} |
| 165 | + |
| 166 | +The HelmChart v2 installation method requires KOTS v1.99.0 or later. If you have existing customers that have not yet upgraded to KOTS v1.99.0 or later, Replicated recommends that you support both the HelmChart v2 and v1 installation methods from the same release until all installations are running KOTS v1.99.0 or later. |
| 167 | + |
| 168 | +To support both installation methods from the same release, include both versions of the HelmChart custom resource for each Helm chart in your application releases (HelmChart `kots.io/v1beta2` and HelmChart `kots.io/v1beta1` with `useHelmInstall: true`). |
| 169 | + |
| 170 | +When you include both versions of the HelmChart custom resource for a Helm chart, installations with KOTS v1.98.0 or earlier use the v1 method, while installations with KOTS v1.99.0 or later use v2. |
| 171 | + |
| 172 | +After all customers are using KOTS v1.99.0 or later, you can remove the HelmChart v1 custom resources so that all customers are using the HelmChart v2 method. |
| 173 | + |
| 174 | +## HelmChart v2 Migration FAQs |
| 175 | + |
| 176 | +This section includes FAQs related to migrating existing installations to the KOTS HelmChart v2 method. |
| 177 | + |
| 178 | +### Which migration scenarios require the `kots.io/keep` annotation? |
| 179 | + |
| 180 | +When applied to a resource in a release, the `kots.io/keep` annotation prevents the given resource from being uninstalled. The `kots.io/keep` annotation can be used to prevent KOTS from deleting resources that were adopted into Helm charts or otherwise previously deployed without Helm. |
| 181 | + |
| 182 | +To prevent existing resources from being uninstalled during upgrade, the `kots.io/keep` annotation is required for the following types of migrations: |
| 183 | + * Applications previously packaged as Kubernetes manifests migrating to HelmChart v2 |
| 184 | + * HelmChart v1 with `useHelmInstall: false` migrating to HelmChart v2 |
| 185 | + |
| 186 | +`kots.io/keep` is _not_ needed when migrating from HelmChart v1 with `useHelmInstall: true` to HelmChart v2. |
| 187 | + |
| 188 | +### Which migration scenarios require the `--take-ownership` flag? |
| 189 | + |
| 190 | +When the `--take-ownership` flag is enabled, Helm automatically takes ownership of resources that were previously deployed to the cluster without Helm. |
| 191 | + |
| 192 | +The `--take-ownership` flag is required for the following types of migrations: |
| 193 | + * Applications previously packaged as Kubernetes manifests migrating to HelmChart v2 |
| 194 | + * HelmChart v1 with `useHelmInstall: false` migrating to HelmChart v2 |
| 195 | + |
| 196 | +`--take-ownership` is _not_ needed when migrating from HelmChart v1 with `useHelmInstall: true` to HelmChart v2. |
| 197 | + |
| 198 | +### What is the difference between HelmChart v1 with `useHelmInstall: false` and `useHelmInstall: true`? |
| 199 | + |
| 200 | +With HelmChart v1 and `useHelmInstall: false`, KOTS renders the Helm templates and deploys them as standard Kubernetes manifests using `kubectl apply`. This differs from both the HelmChart v1 with `useHelmInstall: true` and HelmChart v2 methods, where KOTS installs the application using Helm. |
| 201 | + |
| 202 | +Because the HelmChart v1 with `useHelmInstall: false` method does not deploy resources with Helm, it is necessary to use the `kots.io/keep` annotation and the Helm `--take-ownership` flag when migrating to the HelmChart v2 installation method. These ensure that Helm can take ownership of existing resources and that the resources are not uninstalled during upgrade. |
| 203 | + |
| 204 | +For more information about how KOTS deploys Helm charts, including information about the deprecated HelmChart v1 installation methods, see [About Distributing Helm Charts with KOTS](helm-native-about). |
0 commit comments