helm 安装
- 下载
helm releases 版本下载地址:https://github.com/helm/helm/releases
- 准备
1,解压并拷贝
tar -xzvf helm-v2.12.0-linux-amd64.tar.gz
cd linux-amd64 && mv helm /usr/bin/
压缩中包含两个可执行文件helm,tiller。其中tiller为server,若采用容器化部署到kubernetes中,则可以不用管tiller,只需将helm复制到/usr/bin目录即可。
2,创建tiller用户
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
创建初始化helm时的账户,否则在helm使用时容易报出权限错误:Error: namespaces "kubeapps" is forbidden: User "system:serviceaccount:kube-system:default" cannot get namespaces in the namespace "kubeapps"
若helm已经部署完成未指定tiller serviceaccount 而报错,则可以将tiller更新到deploy中(若为初始化,不用执行此步)
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
- 初始化
helm init --tiller-image=sapcc/tiller:v2.12.0 --service-account tiller
此处指定tiller的镜像为docker hub上的tiller对应镜像:sapcc/tiller;
由于从Google上下载镜像可能存在网络不通的情况(如下图错误:Failed to pull image "gcr.io/kubernetes-helm/tiller:v2.12.0": rpc error: code = Unknown desc = Error response from daemon: Get https://gcr.io/v1/_ping: dial tcp 108.177.125.82:443: i/o timeout)
helm version
若出现如下两行信息说明部署成功
Client: &version.Version{SemVer:"v2.12.0", GitCommit:"d325d2a9c179b33af1a024cdb5a4472b6288016a", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.12.0", GitCommit:"d325d2a9c179b33af1a024cdb5a4472b6288016a", GitTreeState:"clean"}
- 卸载
helm reset
Tiller (the Helm server-side component) has been uninstalled from your Kubernetes Cluster.