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/