[Reprint] Helm V2 to V3 version migration

 

Helm V2 to V3 version migration

 

 

 

Installation Helm V3

helm2 migration helm3, environment preparation

$ helm3 version
version.BuildInfo{Version:"v3.0.0-beta.3", GitCommit:"5cb923eecbe80d1ad76399aee234717c11931d9a", GitTreeState:"clean", GoVersion:"go1.12.9"} $ helm2 repo list NAME URL stable http://mirror.azure.cn/kubernetes/charts/ local http://127.0.0.1:8879/charts $ helm3 repo list Error: no repositories to show

HELM-2TO3 plug

$ helm3 plugin install https://github.com/helm/helm-2to3
Downloading and installing helm-2to3 v0.1.1 ...
https://github.com/helm/helm-2to3/releases/download/v0.1.1/helm-2to3_0.1.1_darwin_amd64.tar.gz
Installed plugin: 2to3

Confirm whether the installation was successful

$ helm3 plugin list
NAME	VERSION	DESCRIPTION
2to3	0.1.1 	migrate Helm v2 configuration and releases in-place to Helm v3

$ helm3 2to3
Migrate Helm v2 configuration and releases in-place to Helm v3
Usage:
 2to3 [command]
Available Commands:
 convert migrate Helm v2 release in-place to Helm v3
 help Help about any command
 move migrate Helm v2 configuration in-place to Helm v3
Flags:
 -h, --help help for 2to3
Use "2to3 [command] --help" for more information about a command.

Now plug-in support feature has two major components:

  • Helm V2 configuration migration
  • Migration Helm V2 release

Begin the migration

$ helm3 2to3 move config
[Helm 2] Home directory: /Users/ych/.helm
[Helm 3] Config directory: /Users/ych/Library/Preferences/helm
[Helm 3] Data directory: /Users/ych/Library/helm
[Helm 3] Create config folder "/Users/ych/Library/Preferences/helm" .
[Helm 3] Config folder "/Users/ych/Library/Preferences/helm" created.
[Helm 2] repositories file "/Users/ych/.helm/repository/repositories.yaml" will copy to [Helm 3] config folder "/Users/ych/Library/Preferences/helm/repositories.yaml" .
[Helm 2] repositories file "/Users/ych/.helm/repository/repositories.yaml" copied successfully to [Helm 3] config folder "/Users/ych/Library/Preferences/helm/repositories.yaml" .
[Helm 3] Create data folder "/Users/ych/Library/helm" .
[Helm 3] data folder "/Users/ych/Library/helm" created.
[Helm 2] plugins "/Users/ych/.helm/plugins" will copy to [Helm 3] data folder "/Users/ych/Library/helm/plugins" .
[Helm 2] plugins "/Users/ych/.helm/plugins" copied successfully to [Helm 3] data folder "/Users/ych/Library/helm/plugins" .
[Helm 2] starters "/Users/ych/.helm/starters" will copy to [Helm 3] data folder "/Users/ych/Library/helm/starters" .
[Helm 2] starters "/Users/ych/.helm/starters" copied successfully to [Helm 3] data folder "/Users/ych/Library/helm/starters" .

The above operation will be moved:

  • Chart starters
  • Chart warehouse
  • Plug

Confirm whether the installation was successful

$ helm3 repo list
NAME 	URL
stable 	http://mirror.azure.cn/kubernetes/charts/
local 	http://127.0.0.1:8879/charts

$ helm3 plugin list
NAME	VERSION	DESCRIPTION
2to3	0.1.1 	migrate Helm v2 configuration and releases in-place to Helm v3
push	0.7.1 	Push chart package to ChartMuseum

A non-default directory migration

Helm V2 main non-default directory and Helm V3 configuration and data directory

$ export HELM_V2_HOME=$HOME/.helm2
$ export HELM_V3_CONFIG=$HOME/.helm3
$ export HELM_V3_DATA=$PWD/.helm3
$ helm3 2to3 move config

Migration Helm V2 Release

Command Detailed

#命令详解:
$ helm3 2to3 convert -h
migrate Helm v2 release in-place to Helm v3
Usage:
 2to3 convert [flags] RELEASE
Flags:
 --delete-v2-releases v2 releases are deleted after migration. By default, the v2 releases are retained
 --dry-run simulate a convert
 -h, --help help for convert
 -l, --label string label to select tiller resources by (default "OWNER=TILLER")
 -s, --release-storage string v2 release storage type/object. It can be 'secrets' or 'configmaps'. This is only used with the 'tiller-out-cluster' flag (default "secrets")
 -t, --tiller-ns string namespace of Tiller (default "kube-system")
 --tiller-out-cluster when Tiller is not running in the cluster e.g. Tillerless
 # 可以看到最后的 --tiller-out-cluster 参数,甚至支持 Tillerless Helm v2。

View helm list

$ helm list
NAME 	REVISION	UPDATED 	STATUS 	CHART 	APP VERSION	NAMESPACE
minio	 1 	Wed Sep 11 11:47:51 2019	DEPLOYED	minio-2.5.13	RELEASE.2019-08-07T01-59-21Z	argo
redis 	1 	Wed Sep 11 14:52:57 2019	DEPLOYED	redis-9.1.7 	5.0.5 	redis

test

The safest way is to use the effect of this parameter under test:

$ helm3 2to3 convert --dry-run minio
NOTE: This is in dry-run mode, the following actions will not be executed.
Run without --dry-run to take the actions described below:
Release "minio" will be converted from Helm 2 to Helm 3.
[Helm 3] Release "minio" will be created.
[Helm 3] ReleaseVersion "minio.v1" will be created.

migrate

Verify that no problem, we'll perform the migration.

We can see the dry-run mode, the following description of some of the above information, there is no problem, then you can really to perform the migration:

# 开始迁移
$ helm3 2to3 convert minio
Release "minio" will be converted from Helm 2 to Helm 3.
[Helm 3] Release "minio" will be created.
[Helm 3] ReleaseVersion "minio.v1" will be created.
[Helm 3] ReleaseVersion "minio.v1" created.
[Helm 3] Release "minio" created.
Release "minio" was converted successfully from Helm 2 to Helm 3. Note: the v2 releases still remain and should be removed to avoid conflicts with the migrated v3 releases.

# 迁移完成后的
$ helm list
NAME 	REVISION	UPDATED 	STATUS 	CHART 	APP VERSION	NAMESPACE
minio	 1 	Wed Sep 11 11:47:51 2019	DEPLOYED	minio-2.5.13	RELEASE.2019-08-07T01-59-21Z	argo
redis 	1 	Wed Sep 11 14:52:57 2019	DEPLOYED	redis-9.1.7 	5.0.5 	redis
$ helm3 list
NAME 	NAMESPACE	REVISION	UPDATED 	STATUS 	CHART

# 需要指定名称空间才能看到
$ helm3 list -n argo
NAME 	NAMESPACE	REVISION	UPDATED 	STATUS 	CHART
minio	argo 	1 	2019-09-11 03:47:51.239461137 +0000 UTC	deployed	minio-2.5.13

note

Note: Because we -delete-v2-releases option is not specified, so Helm V2 minio release this information still exists, we can be deleted after use kubectl.

When you're ready to migrate all of your releases, you can loop inside helm list to automatically release all of each Helm V2 release version to migrate to Helm V3.

If you are using Tillerless Helm V2, only you need to specify -tiller-out-cluster option to migrate to release:

$ helm3 2to3 convert minio --tiller-out-cluster

Clean up the data helm2

  • Delete home folder ~ / .helm
  • If you do not use the -delete-v2-releases option, then the old use kubectl tool to remove Tiller releases data
  • Uninstall annoying Tiller
 

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/11870608.html