简介

https://www.qikqiak.com/k8strain2/helm

https://github.com/helm/helm/releases

https://helm.sh
image.png

下载Helm

https://helm.sh/zh/docs/intro/quickstart

二进制部署

https://github.com/helm/helm/releases

  1. wget https://get.helm.sh/helm-v3.5.4-linux-amd64.tar.gz
  2. tar xf helm-v3.5.4-linux-amd64.tar.gz
  3. mv linux-amd64/helm /usr/local/bin/

wget https://get.helm.sh/helm-v3.6.0-linux-amd64.tar.gz

本地脚本直接部署

  1. curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
  2. chmod 700 get_helm.sh
  3. ./get_helm.sh

直接执行安装,运行

  1. curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

helm命令行

https://helm.sh/zh/docs/helm/helm/

helm 命令自动补全

临时设定

  1. source <(helm completion bash)

写配置文件

echo "source <(helm completion bash)" >>  ~/.bash_profile

bash-completion添加配置

helm completion bash > /usr/share/bash-completion/completions/helm

添加helm仓库

helm repo add bitnami https://charts.bitnami.com/bitnami

查看所有仓库

[root@liwm ~]# helm repo list
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
NAME            URL
rancher-latest  https://releases.rancher.com/server-charts/latest
jetstack        https://charts.jetstack.io
bitnami         https://charts.bitnami.com/bitnami
[root@liwm ~]#

更新仓库

  • 阿里云的源 https://apphub.aliyuncs.com
  • 微软azure的源 http://mirror.azure.cn/kubernetes/charts/
    [root@liwm ~]# helm repo update
    WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
    WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
    Hang tight while we grab the latest from your chart repositories...
    ...Successfully got an update from the "jetstack" chart repository
    ...Successfully got an update from the "rancher-latest" chart repository
    ...Successfully got an update from the "bitnami" chart repository
    Update Complete. ⎈Happy Helming!⎈
    [root@liwm ~]#
    
[root@liwm ~]# helm repo list
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
NAME            URL
rancher-latest  https://releases.rancher.com/server-charts/latest
jetstack        https://charts.jetstack.io
bitnami         https://charts.bitnami.com/bitnami
stable          https://burdenbear.github.io/kube-charts-mirror
stable-ali      https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts/
[root@liwm ~]# helm search repo stable/mysql
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
NAME                    CHART VERSION   APP VERSION     DESCRIPTION
stable/mysql            1.6.8           5.7.30          Fast, reliable, scalable, and easy to use open-...
stable/mysqldump        2.6.2           2.4.1           DEPRECATED! - A Helm chart to help backup MySQL...
[root@liwm ~]#
[root@liwm ~]# helm search repo stable/mysql -l
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
NAME                    CHART VERSION   APP VERSION     DESCRIPTION
stable/mysql            1.6.8           5.7.30          Fast, reliable, scalable, and easy to use open-...
stable/mysql            1.6.7           5.7.30          Fast, reliable, scalable, and easy to use open-...
stable/mysql            1.6.6           5.7.30          Fast, reliable, scalable, and easy to use open-...
stable/mysql            1.6.5           5.7.30          Fast, reliable, scalable, and easy to use open-...
stable/mysql            1.6.4           5.7.30          Fast, reliable, scalable, and easy to use open-...
stable/mysql            1.6.3           5.7.28          Fast, reliable, scalable, and easy to use open-...
stable/mysql            1.6.2           5.7.28          Fast, reliable, scalable, and easy to use open-...
stable/mysql            1.6.1           5.7.27          Fast, reliable, scalable, and easy to use open-...
stable/mysql            1.6.0           5.7.27          Fast, reliable, scalable, and easy to use open-...

helm chart包结构

[root@liwm ~]# helm create liwm
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
[root@liwm ~]# cd liwm/
[root@liwm liwm]#
[root@liwm liwm]# ls -l
total 8
drwxr-xr-x 1 root root  512 May 29 10:09 charts
-rw-r--r-- 1 root root 1140 May 29 10:09 Chart.yaml
drwxr-xr-x 1 root root  512 May 29 10:09 templates
-rw-r--r-- 1 root root 1871 May 29 10:09 values.yaml
[root@liwm liwm]#

helm插件安装

[root@liwm ~]# helm plugin install https://github.com/chartmuseum/helm-push
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
Downloading and installing helm-push v0.9.0 ...
https://github.com/chartmuseum/helm-push/releases/download/v0.9.0/helm-push_0.9.0_linux_amd64.tar.gz
Installed plugin: push
[root@liwm ~]# helm plugin list
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
NAME    VERSION DESCRIPTION
push    0.9.0   Push chart package to ChartMuseum
[root@liwm ~]#

helm push

helm 应用

使用 helm 生成部署模板并使用 kusutomize 定制化

https://www.zhaowenyu.com/helm-doc/usage/quickstart-helm3.html