helm2 的架构跟 helm3 的架构不同。
在 helm2 架构中,helm 是客户端,tiller 是服务端部署在 k8s 集群内部。
1、使用二进制包安装 helm 客户端
wget https://get.helm.sh/helm-v2.16.9-linux-amd64.tar.gz
tar xvf helm-v2.16.9-linux-amd64.tar.gz
cd linux-amd64
cp -a helm /usr/local/bin/
2、设置命令行自动补全
echo "source <(helm completion bash)" >> ~/.bashrc
3、安装 tiller 服务端
kubectl apply -f helm-rbac.yam
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: tiller
namespace: kube-system
helm init --service-account tiller --tiller-image=registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.16.6 --stable-repo-url http://mirror.azure.cn/kubernetes/charts
kubectl get deployment tiller-deploy -n kube-system
helm version
Client: &version.Version{SemVer:"v2.16.9", GitCommit:"8ad7037828e5a0fca1009dabe290130da6368e39", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.16.6", GitCommit:"dd2e5695da88625b190e6b22e9542550ab503a47", GitTreeState:"clean"}
4、添加 repo
helm repo add stable http://mirror.azure.cn/kubernetes/charts
helm repo add incubator http://mirror.azure.cn/kubernetes/charts-incubator
helm repo add svc-cat http://mirror.azure.cn/kubernetes/svc-catalog-charts
5、更新 repo
helm repo update
6、安装一个 app
helm install stable/nginx-ingress --name nginx-ingress --namespace nginx-ingress
helm install stable/owncloud --name owncloud --namespace owncloud
helm ls -a
7、删除一个 app
helm delete --purge owncloud
8、卸载 helm(tiller)
helm reset --force
kubectl delete service/tiller-deploy -n kube-system
kubectl delete deployment.apps/tiller-deploy -n kube-system
参考:
https://devopscube.com/install-configure-helm-kubernetes/
https://github.com/helm/helm/releases
https://helm.sh/docs/intro/install/
https://helm.sh/docs/helm/helm_completion/
https://github.com/helm/charts
https://hub.helm.sh/charts
https://github.com/goharbor/harbor-helm
https://kubesphere.com.cn/docs/zh-CN/developer/helm-developer-guide/