Loading

快速运维 - K8s

更新日志: - 2023.10.31 1055 初始化

HELM

Helm是一个用于k8s的包管理器,使用helm之后就不需要了解k8s的yaml语法并编写应用部署文件,可以通过helm下载并在k8s上安装需要的应用。
Helm还提供了k8s的软件部署,删除,升级,回滚应用的强大功能。

展示配置

helm show values [CHART] [flags]

    --ca-file string             verify certificates of HTTPS-enabled servers using this CA bundle
      --cert-file string           identify HTTPS client using this SSL certificate file
      --devel                      use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored
  -h, --help                       help for values
      --insecure-skip-tls-verify   skip tls certificate checks for the chart download
      --jsonpath string            supply a JSONPath expression to filter the output
      --key-file string            identify HTTPS client using this SSL key file
      --keyring string             location of public keys used for verification (default "~/.gnupg/pubring.gpg")
      --pass-credentials           pass credentials to all domains
      --password string            chart repository password where to locate the requested chart
      --repo string                chart repository url where to locate the requested chart
      --username string            chart repository username where to locate the requested chart
      --verify                     verify the package before using it
      --version string             specify a version constraint for the chart version to use. This constraint can be a specific tag (e.g. 1.1.1) or it may reference a valid range (e.g. ^2.0.0). If this is not specified, the latest version is used

示例:展示bitnami仓库下的mysql的可选配置,并用管道重定向保存到mysql.yaml中

helm show values bitnami/mysql > mysql.yaml

列表

列举安装的应用

helm list

卸载

卸载已安装的包

helm uninstall -n <namespace> RELEASE_NAME [...] [flags]

示例:卸载安装在TRS空间的mariadb包

root@master /k8s [1]# helm list -A
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                                   APP VERSION
ingress-nginx   ingress-nginx   1               2023-08-19 13:57:08.208634825 +0800 CST deployed        ingress-nginx-4.7.1                     1.8.1
mariadb         trs             4               2023-09-26 16:26:25.30996393 +0800 CST  deployed        mariadb-13.0.2                          11.0.2
metallb         metallb         1               2023-08-19 14:24:37.262083111 +0800 CST deployed        metallb-4.6.4                           0.13.10
mysql           trs             9               2023-09-26 16:20:44.276640223 +0800 CST failed          mysql-9.10.10                           8.0.34
nfs             default         1               2023-08-13 14:23:36.334033351 +0800 CST deployed        nfs-subdir-external-provisioner-4.0.18  4.0.2
nginx           trs             1               2023-09-26 16:00:16.428456552 +0800 CST deployed        nginx-15.1.2                            1.25.1
rabbitmq        trs             1               2023-08-23 14:50:30.285538015 +0800 CST deployed        rabbitmq-12.0.10                        3.12.2
redis           trs             5               2023-09-26 16:03:31.154321306 +0800 CST deployed        redis-17.15.2                           7.0.12

root@master /k8s# helm uninstall -n trs mariadb
release "mariadb" uninstalled

更新已安装的应用

helm upgrade <NAME> <repository> --namespace trs -f <配置文件.yml>

示例:更新了NGINX的配置,升级应用

root@master /k8s [1]# helm list -A
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                                   APP VERSION
……
nginx           trs             1               2023-09-26 16:00:16.428456552 +0800 CST deployed        nginx-15.1.2                            1.25.1
……
root@master /k/helm# helm get values nginx -n trs | grep repository
    repository: bitnami/git
  repository: ""
  repository: bitnami/nginx
    repository: bitnami/nginx-exporter
helm upgrade nginx bitnami/nginx --namespace trs -f nginx.yaml
posted @ 2023-10-31 10:55  p#ssw0rd  阅读(24)  评论(0编辑  收藏  举报