Helm V2 迁移到 V3

    一键安装:

    检查插件是否安装成功:

    1. $ helm3 plugin list
    2. NAME VERSION DESCRIPTION
    3. 2to3 0.1.1 migrate Helm v2 configuration and releases in-place to Helm v3
    1. $ helm3 2to3 move config
    2. [Helm 2] Home directory: /root/.helm
    3. [Helm 3] Config directory: /root/.config/helm
    4. [Helm 3] Data directory: /root/.local/share/helm
    5. [Helm 3] Create config folder "/root/.config/helm" .
    6. [Helm 3] Config folder "/root/.config/helm" created.
    7. [Helm 2] repositories file "/root/.helm/repository/repositories.yaml" will copy to [Helm 3] config folder "/root/.config/helm/repositories.yaml" .
    8. [Helm 2] repositories file "/root/.helm/repository/repositories.yaml" copied successfully to [Helm 3] config folder "/root/.config/helm/repositories.yaml" .
    9. [Helm 3] Create data folder "/root/.local/share/helm" .
    10. [Helm 3] data folder "/root/.local/share/helm" created.
    11. [Helm 2] plugins "/root/.helm/plugins" will copy to [Helm 3] data folder "/root/.local/share/helm/plugins" .
    12. [Helm 2] plugins "/root/.helm/plugins" copied successfully to [Helm 3] data folder "/root/.local/share/helm/plugins" .
    13. [Helm 2] starters "/root/.helm/starters" copied successfully to [Helm 3] data folder "/root/.local/share/helm/starters" .
    • Chart 仓库
    • Helm 插件
    • Chart starters

    检查下 repo 和 plugin:

    已经用 Helm V2 部署的应用也可以使用 2to3 的 子命令迁移到 V3,先看下有哪些选项:

    1. $ helm3 2to3 convert --help
    2. migrate Helm v2 release in-place to Helm v3
    3. Usage:
    4. 2to3 convert [flags] RELEASE
    5. Flags:
    6. --delete-v2-releases v2 releases are deleted after migration. By default, the v2 releases are retained
    7. --dry-run simulate a convert
    8. -h, --help help for convert
    9. -l, --label string label to select tiller resources by (default "OWNER=TILLER")
    10. -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")
    11. -t, --tiller-ns string namespace of Tiller (default "kube-system")
    12. --tiller-out-cluster when Tiller is not running in the cluster e.g. Tillerless
    • --tiller-out-cluster: 如果你的 Helm V2 是 tiller 在集群外面 (tillerless) 的安装方式,请带上这个参数
    • --tiller-ns: 通常 tiller 如果部署在集群中,并且不在 kube-system 命名空间才指定
    1. NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
    2. redis 1 Mon Sep 16 14:46:58 2019 DEPLOYED redis-9.1.3 5.0.5 default

    选一个用 --dry-run 试下效果:

    没有报错,去掉 --dry-run 执行迁移:

    1. $ helm3 2to3 convert redis
    2. Release "redis" will be converted from Helm 2 to Helm 3.
    3. [Helm 3] Release "redis" will be created.
    4. [Helm 3] ReleaseVersion "redis.v1" will be created.
    5. [Helm 3] ReleaseVersion "redis.v1" created.
    6. [Helm 3] Release "redis" created.
    7. Release "redis" 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.
    1. $ helm ls
    2. NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
    3. redis 1 Mon Sep 16 14:46:58 2019 DEPLOYED redis-9.1.3 5.0.5 default
    4. $
    5. $
    6. $ helm3 ls -a
    7. NAME NAMESPACE REVISION UPDATED STATUS CHART