[root@node-0 bin]# helm3 plugin list NAME VERSION DESCRIPTION 2to3 0.6.0 migrate and cleanup Helm v2 configuration and releases in-place to Helm v3
查看该插件具有哪些功能:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
[root@node-0 bin]# helm3 2to3 Migrate and Cleanup Helm v2 configuration and releases in-place to Helm v3
Usage: 2to3 [command]
Available Commands: cleanup cleanup Helm v2 configuration, release data and Tiller deployment 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, --helphelpfor2to3
Use "2to3 [command] --help"for more information about acommand.
[root@node-0 bin]# helm3 2to3 move config --dry-run 2020/07/2710:41:56 NOTE: This isin dry-run mode, the following actions will not be executed. 2020/07/2710:41:56 Run without--dry-run to take the actions described below: 2020/07/2710:41:56 2020/07/2710:41:56WARNING: Helm v3 configuration may be overwritten during this operation. 2020/07/2710:41:56 [Move Config/confirm] Are you sure you want tomove the v2 configuration? [y/N]: y 2020/07/2710:41:59 Helm v2 configuration will be moved to Helm v3 configuration. 2020/07/2710:41:59 [Helm 2] Home directory: /root/.helm 2020/07/2710:41:59 [Helm 3] Config directory: /root/.config/helm 2020/07/2710:41:59 [Helm 3] Data directory: /root/.local/share/helm 2020/07/2710:41:59 [Helm 3] Cache directory: /root/.cache/helm 2020/07/2710:41:59 [Helm 3] Create config folder "/root/.config/helm" . 2020/07/2710:41:59 [Helm 2] repositories file "/root/.helm/repository/repositories.yaml" will copyto [Helm 3] config folder "/root/.config/helm/repositories.yaml" . 2020/07/2710:41:59 [Helm 3] Createcache folder "/root/.cache/helm" . 2020/07/2710:41:59 [Helm 3] Create data folder "/root/.local/share/helm" . 2020/07/2710:41:59 [Helm 2] starters "/root/.helm/starters" will copyto [Helm 3] data folder "/root/.local/share/helm/starters" .
Flags: --delete-v2-releases v2 release versions are deleted after migration. By default, the v2 release versions are retained --dry-run simulate a command -h, --help help for convert --kube-context string name of the kubeconfig context touse --kubeconfig stringpathto the kubeconfig file -l, --label string label toselect 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") --release-versions-max int limit the maximum number of versions converted per release. Use0for no limit (default 10) -t, --tiller-ns stringnamespace of Tiller (default "kube-system") --tiller-out-clusterwhen Tiller isnot running in the clustere.g. Tillerless
首先查看一下已经使用Helm v2安装的应用,以便后续进行迁移测试:
1 2 3
[root@node-0 helm]# helm list NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE sanguine-mouse 1 Mon Jul 2711:07:072020 DEPLOYED mysql-1.6.65.7.30 default
自然使用--dry-run进行模拟迁移:
1 2 3 4 5 6 7
[root@node-0 helm]# helm3 2to3 convert --dry-run sanguine-mouse 2020/07/2711:09:19 NOTE: This is in dry-run mode, the following actions will not be executed. 2020/07/2711:09:19 Run without --dry-run to take the actions described below: 2020/07/2711:09:19 2020/07/2711:09:19 Release "sanguine-mouse" will be converted from Helm v2 to Helm v3. 2020/07/2711:09:19 [Helm 3] Release "sanguine-mouse" will be created. 2020/07/2711:09:19 [Helm 3] ReleaseVersion "sanguine-mouse.v1" will be created.
模拟迁移成功,进行实际迁移:
1 2 3 4 5 6 7 8 9
[root@node-0 helm]# helm3 2to3 convert sanguine-mouse 2020/07/2711:10:20 Release "sanguine-mouse" will be converted from Helm v2 to Helm v3. 2020/07/2711:10:20 [Helm 3] Release "sanguine-mouse" will be created. 2020/07/2711:10:20 [Helm 3] ReleaseVersion "sanguine-mouse.v1" will be created. 2020/07/2711:10:21 [Helm 3] ReleaseVersion "sanguine-mouse.v1" created. 2020/07/2711:10:21 [Helm 3] Release "sanguine-mouse" created. 2020/07/2711:10:21 Release "sanguine-mouse" was converted successfully from Helm v2 to Helm v3. 2020/07/2711:10:21 Note: The v2 release information still remains and should be removed to avoid conflicts with the migrated v3 release. 2020/07/2711:10:21 v2 release information should only be removed using `helm 2to3` cleanup and when all releases have been migrated over.
分别使用helm和helm3命令查看是否迁移成功:
1 2 3
[root@node-0 helm]# helm list NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE sanguine-mouse 1 Mon Jul 2711:07:072020 DEPLOYED mysql-1.6.65.7.30 default
1 2 3
[root@node-0 helm]# helm3 list NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION sanguine-mouse default 12020-07-2703:07:07.599071812 +0000 UTC deployed mysql-1.6.65.7.30
[root@node-0 bin]# helm32to3cleanup -h cleanup Helm v2 configuration,release data and Tiller deployment
Usage: 2to3cleanup [flags]
Flags: --config-cleanup if set, configuration cleanup performed --dry-run simulate a command -h, --help help for cleanup --kube-context string name of the kubeconfig context to use --kubeconfig string path to the kubeconfig file -l, --label string label toselect Tiller resources by (default"OWNER=TILLER") --name string the release name. When it is specified, the named releaseand its versions will be removed only. Should not be used with other cleanup operations --release-cleanup if set,release data cleanup performed -s, --release-storage string v2release storage type/object. It can be 'secrets' or 'configmaps'. This is only used with the 'tiller-out-cluster' flag (default"secrets") --skip-confirmation if set, skips confirmation message before performing cleanup --tiller-cleanup if set, Tiller cleanup performed -t, --tiller-ns string namespace of Tiller (default"kube-system") --tiller-out-cluster when Tiller is not running in the cluster e.g. Tillerless
clean命令可以清理如下文件:
配置(Helm主目录)
v2发布数据
Tiller deployment(我暂时不知道这是什么)
同样的,自然是从最cool也最安全的--dry-run开始:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
[root@node-0 bin]# helm3 2to3 cleanup --dry-run 2020/07/2711:01:30 NOTE: This isin dry-run mode, the following actions will not be executed. 2020/07/2711:01:30 Run without --dry-run totake the actions described below: 2020/07/2711:01:30 WARNING:"Helm v2 Configuration""Release Data""Tiller" will be removed. This will clean up all releases managed by Helm v2. It will not be possible to restore them if you haven't made a backup of the releases. Helm v2 may not be usable afterwards.
[Cleanup/confirm] Are you sure you want to cleanup Helm v2 data? [y/N]: y 2020/07/2711:01:32 Helm v2 data will be cleaned up. 2020/07/2711:01:32 [Helm 2] Releases will be deleted. 2020/07/2711:01:32 [Helm 2] no deployed releases fornamespace: kube-system, owner: OWNER=TILLER 2020/07/2711:01:32 [Helm 2] Tiller in"kube-system"namespace will be removed. 2020/07/2711:01:32 [Helm 2] Home folder "/root/.helm" will be deleted.
[root@node-0 helm]# helm3 search repo brigade WARNING: Repo "stable" is corrupt or missing. Try 'helm repo update'.WARNING: Repo "brigade" is corrupt or missing. Try 'helm repo update'.No results found
brigade这个库是从Helm v2迁移过来的,看样子迁移过后需要更新一下存储库:
1 2 3 4 5
[root@node-0 helm]# helm3 repo update Hang tight while we grab the latest from your chart repositories... ...Successfully got an updatefrom the "brigade" chart repository ...Successfully got an updatefrom the "stable" chart repository Update Complete. ⎈ Happy Helming!⎈
更新完毕后再次搜索指定存储库:
1 2 3 4 5 6 7 8
[root@node-0 helm]# helm3 search repo brigade NAME CHART VERSION APP VERSION DESCRIPTION brigade/brigade 1.6.1v1.4.0Brigade provides event-driven scripting of Kube... brigade/brigade-github-app 0.7.1v0.4.1 The Brigade GitHub App, an advanced gateway for... brigade/brigade-github-oauth 0.3.0v0.20.0 The legacy OAuth GitHub Gateway for Brigade brigade/brigade-k8s-gateway 0.3.0 A Helm chart for Kubernetes brigade/brigade-project 1.0.0v1.0.0 Create a Brigade project brigade/kashti 0.5.0v0.4.0 A Helm chart for Kubernetes