helm在kubernetes环境中搭建
1.安装helm
1.1.安装helm客户端
各个版本的helm:https://github.com/helm/helm/releases
wget https://get.helm.sh/helm-v2.14.3-linux-amd64.tar.gz
tar -zxvf helm-v2.14.3-linux-amd64.tar.gz
mv linux-amd64/helm /usr/local/bin/
chmod +x /usr/local/bin/helm
helm version
1.2.安装helm tiller(server)端
离线安装请查看
1.2.1.为应用程序设置serviceaccount
kubectl create -f helm-rbac-config.yaml
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
1.2.2.安装tiller
helm init --upgrade -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.14.3 --stable-repo-url [https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts](https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts)
[root@k8s1-master1 ~]# helm version
Client: &version.Version{SemVer:"v2.14.3", GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.14.3", GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}
#如果报错如下:
Client: &version.Version{SemVer:"v2.14.3", GitCommit:"bbc1f71dc03afc5f00c6ac84b9308f8ecb4f39ac", GitTreeState:"clean"}
E0921 16:19:09.448738 24295 portforward.go:331] an error occurred forwarding 39401 -> 44134: error forwarding port 44134 to pod 5b85aa2aa4347d59ea30edf466a7e01a198780151d30644a16b5cab4ceb2b83d, uid : unable to do port forwarding: socat not found.
Error: cannot connect to Tiller
#解决办法:在k8s的node节点安装ssocat即可解决
$sudo yum install socat
1.2.3.卸载Helm镜像等k8s资源
helm reset -f
或
kubectl get -n kube-system secrets,sa,clusterrolebinding -o name|grep tiller|xargs kubectl -n kube-system delete kubectl get all -n kube-system -l app=helm -o name|xargs kubectl delete -n kube-system