参考
https://www.cnrancher.com/docs/rancher/v2.x/cn/installation/ha-install/linux注意
helm使用须要kubectl,点击了解安装和配置kubectl。git
Helm是Kubernetes首选的包管理工具。Helmcharts
为Kubernetes YAML清单文档提供模板语法。使用Helm,咱们能够建立可配置的部署,而不单单是使用静态文件。有关建立本身的charts
的更多信息,请查看https://helm.sh/文档。Helm有两个部分:Helm客户端(helm)和Helm服务端(Tiller)。github
Helm在集群上安装tiller
服务以管理charts
. 因为RKE默认启用RBAC, 所以咱们须要使用kubectl
来建立一个serviceaccount
,clusterrolebinding
才能让tiller
具备部署到集群的权限。shell
kube-system
命名空间中建立ServiceAccount
;ClusterRoleBinding
以授予tiller
账户对集群的访问权限helm
初始化tiller
服务kubectl -n kube-system create serviceaccount tiller kubectl create clusterrolebinding tiller \ --clusterrole cluster-admin --serviceaccount=kube-system:tiller
采用二进制安装
能够在helm
官网上下载Helm,若是速度不理想能够使用rancher自带加速下载Helmapi
wget https://www.cnrancher.com/download/helm/helm-v2.14.1-linux-amd64.tar.gz tar xf helm-v2.14.1-linux-amd64.tar.gz
helm
在解压后的目录中找到二进制文件,并将其移动到所需的位置服务器
sudo mv linux-amd64/helm /usr/local/bin/helm && chmod +x /usr/local/bin/helm
Helm的服务器端部分Tiller,一般运行在Kubernetes集群内部。可是对于开发,它也能够在本地运行,并配置为与远程Kubernetes集群通讯。ide
安装tiller
到集群中最简单的方法就是运行helm init
。这将验证helm
本地环境设置是否正确(并在必要时进行设置)。而后它会链接到kubectl
默认链接的K8S集群(kubectl config view
)。一旦链接,它将安装tiller
到kube-system
命名空间中。工具
helm init
自定义参数:this
--canary-image
参数安装金丝雀版本;--tiller-image
安装特定的镜像(版本);--kube-context
使用安装到特定集群;--tiller-namespace
用一个特定的命名空间(namespace)
安装;注意: 一、RKE默认启用RBAC,因此在安装tiller时须要指定ServiceAccount。 二、helm init在缺省配置下,会去谷歌镜像仓库拉取gcr.io/kubernetes-helm/tiller镜像,在Kubernetes集群上安装配置Tiller;因为在国内可能没法访问gcr.io、storage.googleapis.com等域名,能够经过--tiller-image指定私有镜像仓库镜像。 三、helm init在缺省配置下,会利用https://kubernetes-charts.storage.googleapis.com做为缺省的stable repository地址,并去更新相关索引文件。在国内可能没法访问storage.googleapis.com地址, 能够经过--stable-repo-url指定chart国内加速镜像地址。 四、若是您是离线安装Tiller, 假如没有内部的chart仓库, 可经过添加--skip-refresh参数禁止Tiller更新索引。
在rancher中安装Tillergoogle
wangpeng@test-kube-master-01:~$ helm init --service-account tiller --skip-refresh \ > --tiller-image registry.cn-shanghai.aliyuncs.com/rancher/tiller:v2.14.1 Creating /home/wangpeng/.helm Creating /home/wangpeng/.helm/repository Creating /home/wangpeng/.helm/repository/cache Creating /home/wangpeng/.helm/repository/local Creating /home/wangpeng/.helm/plugins Creating /home/wangpeng/.helm/starters Creating /home/wangpeng/.helm/cache/archive Creating /home/wangpeng/.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 /home/wangpeng/.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
查看helm
状况
wangpeng@test-kube-master-01:~$ helm version Client: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"} Server: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}