安装

安装Helm-client

建议:将helm client安装在k8s的master节点上

我们通过编译好的二进文件进行安装。从https://github.com/helm/helm/releases下载最新版本的压缩包(此时最新版本为v2.13.1,linux系统一般下载linux-amd64)。下载后解压,然后把其中的heml可执行文件拷贝到/usr/local/bin/目录下

$ wget https://storage.googleapis.com/kubernetes-helm/helm-v2.13.1-linux-amd64.tar.gz
$ tar xzvf helm-v2.13.1-linux-amd64.tar.gz
$ cp -vf linux-amd64/helm /usr/local/bin/

然后执行helm help即可看到帮助信息。

安装tiller

集群内安装

最简单的安装tiller的方法就是执行helm init命令,这样helm client便会把tiller安装到k8s集群中。

[root@peng01 linux-amd64]# 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.
To prevent this, run `helm init` with the --tiller-tls-verify flag.
For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation
Happy Helming!

这里你可能会有疑问,helm client是如何知道把tiller安装到哪个集群中的呢?其实,helm client会读取环境变量KUBECONFIG的配置,即kubectl可以连接到哪个集群,则helm client就能连接到哪个集群,所以我们都是建议将helm client安装在k8s的master节点上。

helm init默认会连接https://kubernetes-charts.storage.googleapis.com以及去storage.googleapis.com拉取镜像,很容易被墙。可以通过以下的方法指定tiller镜像版本及stable-repo-url

当我们把tiller安装在k8s集群中时,由于tiller需要访问apiserver,所以需要给tiller配置serviceaccount并给该serviceaccount授权。

然后,更改tiller-deploy使用tiller这个ServiceAccount

当安装好以后,执行helm version命令即可查看tiller的状态

发布一个chart

执行命令helm install stable/tomcat:0.2.0即可安装一个chart,但由于stable这个repository在google,国内访问不了,所以我们可以先翻墙把这个chart下载下来,然后再安装:

执行该命令后,会在default命令空间中生成了一个名字包含tomcatDeploymentService

Reference

Last updated

Was this helpful?