美文网首页
kubernetes学习之helm安装使用

kubernetes学习之helm安装使用

作者: 运维之美 | 来源:发表于2019-12-23 17:24 被阅读0次

1.概念

Helm

Helm 是一个命令行下的客户端工具。主要用于 Kubernetes 应用程序 Chart 的创建、打包、发布以及创建和管理本地和远程的 Chart 仓库。

Tiller

Tiller 是 Helm 的服务端,部署在 Kubernetes 集群中。Tiller 用于接收 Helm 的请求,并根据 Chart 生成 Kubernetes 的部署文件( Helm 称为 Release ),然后提交给 Kubernetes 创建应用。Tiller 还提供了 Release 的升级、删除、回滚等一系列功能。

Chart

Helm 的软件包,采用 TAR 格式。类似于 APT 的 DEB 包或者 YUM 的 RPM 包,其包含了一组定义 Kubernetes 资源相关的 YAML 文件。

Repoistory

Helm 的软件仓库,Repository 本质上是一个 Web 服务器,该服务器保存了一系列的 Chart 软件包以供用户下载,并且提供了一个该 Repository 的 Chart 包的清单文件以供查询。Helm 可以同时管理多个不同的 Repository。

Release

使用 helm install 命令在 Kubernetes 集群中部署的 Chart 称为 Release。
注:需要注意的是:Helm 中提到的 Release 和我们通常概念中的版本有所不同,这里的 Release 可以理解为 Helm 使用 Chart 包部署的一个应用实例。

2.安装Helm

将helm安装在可以执行kubectl命令的节点上
脚本安装

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash
$ chmod 700 get_helm.sh
$ ./get_helm.sh

二进制包安装

$ wget https://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz
tar -xvf helm-v2.9.1-linux-amd64.tar.gz
mv linux-amd64/helm /usr/local/bin/helm

验证版本号

[root@hz-95 ~]# helm version
Client: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState:"clean"}

3.Helm 服务端安装Tiller

Tiller服务器的安装比较简单,直接如下执行就可以了,Tiller作为容器化应用运行在Kubernetes集群中

[root@hz-95 ~]# helm init
Creating /root/.helm
Creating /root/.helm/repository
Creating /root/.helm/repository/cache
Creating /root/.helm/repository/local
Creating /root/.helm/plugins
Creating /root/.helm/starters
Creating /root/.helm/cache/archive
Creating /root/.helm/repository/repositories.yaml
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com
Adding local repo with URL: http://127.0.0.1:8879/charts
$HELM_HOME has been configured at /root/.helm.

Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.

Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.
For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation
Happy Helming!

检查

[root@hz-95 ~]# kubectl get --namespace=kube-system svc tiller-deploy
NAME            CLUSTER-IP     EXTERNAL-IP   PORT(S)     AGE
tiller-deploy   10.254.71.94   <none>        44134/TCP   2m
[root@hz-95 ~]# kubectl get --namespace=kube-system deployment tiller-deploy
NAME            DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
tiller-deploy   1         1         1            0           4m

4.Helm使用

helm的chart存放在helm的仓库中
helm search #查看当前可安装的chart

[root@hz-95 ~]# helm search 
NAME                                    CHART VERSION   APP VERSION             DESCRIPTION
stable/acs-engine-autoscaler            2.2.2           2.1.1                   DEPRECATED Scales worker nodes within agent pools
stable/aerospike                        0.3.1           v4.5.0.5                A Helm chart for Aerospike in Kubernetes
stable/airflow                          5.2.4           1.10.4                  Airflow is a platform to programmatically autho...
stable/ambassador                       5.3.0           0.86.1                  A Helm chart for Datawire Ambassador

helm安装时默认配置好了两个仓库stable和local,helm repo list命令会列出当前仓库,name会显示仓库名

[root@hz-95 ~]# helm repo list
NAME    URL
stable  https://kubernetes-charts.storage.googleapis.com       //官方仓库
local   http://127.0.0.1:8879/charts                                          //本地开发仓库

安装chart,我们使用helm search mysql类似的关键字进行搜索,然后再安装对应仓库和版本的chart

[root@hz-95 ~]# helm search mysql
NAME                                    CHART VERSION   APP VERSION     DESCRIPTION
stable/mysql                            1.6.2           5.7.28          Fast, reliable, scalable, and easy to use open-...
stable/mysqldump                        2.6.0           2.4.1           A Helm chart to help backup MySQL databases usi...
stable/prometheus-mysql-exporter        0.5.2           v0.11.0         A Helm chart for prometheus mysql exporter with...
stable/percona                          1.2.0           5.7.17          free, fully compatible, enhanced, open source d...

相关文章

网友评论

      本文标题:kubernetes学习之helm安装使用

      本文链接:https://www.haomeiwen.com/subject/pbzznctx.html