• 轻松完爆 Helm release


    一、release介绍

    在以上的章节中曾介绍过 helm 的两大术语:chart 和 release。如果可以把 chart 比作程序源码的话,那么 release 则可以看做是程序运行时的进程。

    chart 是用户可直接感知的对象(其表现形式就是 .tgz 格式的压缩包);而 release 理解起来则比较抽象,它是专属于 helm 的一个逻辑概念,用来标识在 k8s 中运行的一组资源。有了 release,helm 在操作 k8s 时,就再也不用逐个管理资源,而可以将一组相关的资源当做一个整体来操作,比如删除或升级。

    二、release 查看

    $ helm ls
    NAME    NAMESPACE       REVISION        UPDATED STATUS  CHART   APP VERSION
    

    三、release 安装

    在线安装指定的 chart,比如 nginx-ingress。

    $ helm repo add nginx-stable https://helm.nginx.com/stable
    $ helm repo update
    
    $ helm search repo nginx-ingress
    NAME                            CHART VERSION   APP VERSION     DESCRIPTION
    aliyun/nginx-ingress            0.9.5           0.10.2          An nginx Ingress controller that uses ConfigMap...
    nginx-stable/nginx-ingress      0.9.3           1.11.3          NGINX Ingress Controller
    stable/nginx-ingress            1.41.3          v0.34.1         DEPRECATED! An nginx Ingress controller that us...
    aliyun/nginx-lego               0.3.1                           Chart for nginx-ingress-controller and kube-lego
    stable/nginx-lego               0.3.1                           Chart for nginx-ingress-controller and kube-lego
    
    $ helm install mynginx-ingress nginx-stable/nginx-ingress
    NAME: mynginx-ingress
    LAST DEPLOYED: Sat Jun 12 16:17:57 2021
    NAMESPACE: default
    STATUS: deployed
    REVISION: 1
    TEST SUITE: None
    NOTES:
    The NGINX Ingress Controller has been installed.
    

    四、release更新

    如果想修改运行时 release 的配置,可以使用 --set 或者 -f 选项进行修改。

    4.1 基于命令行更新 release

    # mynginx-ingress 是上面创建的 release 名;nginx-stable/nginx-ingress 是在线 chart 名
    
    $ helm upgrade --set controller.hostNetwork=true mynginx-ingress nginx-stable/nginx-ingress
    Release "mynginx-ingress" has been upgraded. Happy Helming!
    NAME: mynginx-ingress
    LAST DEPLOYED: Sat Jun 12 16:20:05 2021
    NAMESPACE: default
    STATUS: deployed
    REVISION: 2
    TEST SUITE: None
    NOTES:
    The NGINX Ingress Controller has been installed.
    

    4.2 基于文件更新 release

    如果想基于文件来更新 release,则首先需要将 chart 下载到本地,然后手动修改 chart 的 values.yaml 文件。

    $ helm pull nginx-stable/nginx-ingress
    # 下载 chart
    
    $ tar zxf nginx-ingress-0.9.3.tgz
    # 解压缩 chart
    
    $ sed -i 's/hostNetwork: false/hostNetwork: true/g' nginx-ingress/values.yaml
    # 修改 values.yaml 内容。比如修改 hostNetwork 的值为 true
    
    $ helm upgrade mynginx-ingress nginx-ingress -f nginx-ingress/values.yaml
    Release "mynginx-ingress" has been upgraded. Happy Helming!
    NAME: mynginx-ingress
    LAST DEPLOYED: Sat Jun 12 16:23:50 2021
    NAMESPACE: default
    STATUS: deployed
    REVISION: 3
    TEST SUITE: None
    NOTES:
    The NGINX Ingress Controller has been installed.
    

    4.3 查看 release 更新后的新值

    $ helm get values mynginx-ingress
    

    五、release 版本

    $ helm history mynginx-ingress
    # mynginx-ingress 这个 release 各个历史版本。其中 REVISION 3 是最新的版本。
    REVISION        UPDATED                         STATUS          CHART                   APP VERSION     DESCRIPTION
    1               Sat Jun 12 16:17:57 2021        superseded      nginx-ingress-0.9.3     1.11.3          Install complete
    2               Sat Jun 12 16:20:05 2021        superseded      nginx-ingress-0.9.3     1.11.3          Upgrade complete
    3               Sat Jun 12 16:23:50 2021        deployed        nginx-ingress-0.9.3     1.11.3          Upgrade complete
    

    六、release 回滚

    $ helm rollback mynginx-ingress 1
    Rollback was a success! Happy Helming!
    
    $ helm history mynginx-ingress
    REVISION        UPDATED                         STATUS          CHART                   APP VERSION     DESCRIPTION
    1               Sat Jun 12 16:17:57 2021        superseded      nginx-ingress-0.9.3     1.11.3          Install complete
    2               Sat Jun 12 16:20:05 2021        superseded      nginx-ingress-0.9.3     1.11.3          Upgrade complete
    3               Sat Jun 12 16:23:50 2021        superseded      nginx-ingress-0.9.3     1.11.3          Upgrade complete
    4               Sat Jun 12 16:29:59 2021        deployed        nginx-ingress-0.9.3     1.11.3          Rollback to 1
    

    七、release 卸载

    $ helm uninstall mynginx-ingress
    release "mynginx-ingress" uninstalled
    
    *************** 当你发现自己的才华撑不起野心时,就请安静下来学习吧!***************
  • 相关阅读:
    【区块链整理】四、区块链数据结构
    【区块链整理】三、以太坊挖矿算法 ETHASH
    【区块链整理】二、比特币交易脚本
    【区块链整理】一、概念
    FISCO BCOS CRUD 功能和 CNS 合约命名服务杂记
    前台静态资源打包ios
    叹而立之年,忆往昔旧事
    基于Bootstrap table组件实现多层表头配置
    js或jQuery获取当前屏幕的各种高度
    echarts图表基础配置
  • 原文地址:https://www.cnblogs.com/lvzhenjiang/p/14878530.html
Copyright © 2020-2023  润新知