helm把一系列複雜的有狀態和無狀態服務的部署封裝起來(實際上就是對yaml文件的組織),而後你能夠暴露出一些自定義參數信息供用戶選擇,這樣部署就會變得簡單不少.linux
wget https://get.helm.sh/helm-v2.14.3-linux-amd64.tar.gz tar xf helm-v2.14.3-linux-amd64.tar.gz cd linux-amd64 #進入解壓目錄會看到兩個可執行文件helm和tiller, 若採用容器化部署到kubernetes中,則能夠不用管tiller,只需將helm複製到/usr/bin目錄便可 cp helm /usr/bin/ echo "source <(helm completion bash)" >> /root/.bashrc # 命令自動補全
apiVersion: v1 kind: ServiceAccount metadata: name: tiller namespace: kube-system --- apiVersion: rbac.authorization.k8s.io/v1beta1 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 --upgrade -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.14.3 --stable-repo-url https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
由於牆, 因此指定國內tiller鏡像, tiller標籤和helm保持一致, 這裏是v2.14.3git
kubectl get pods -n kube-system -l app=helm kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
初始化後經過命令查看tiller pod建立狀況github
因爲阿里的chart源可能更新不及時, 會比較老, 因此建議替換爲默認源或者微軟的azure源redis
參考連接: https://github.com/BurdenBear/kube-charts-mirrorapi
helm repo add stable http://mirror.azure.cn/kubernetes/charts/ helm repo add incubator http://mirror.azure.cn/kubernetes/charts-incubator/
命令 | 做用 |
---|---|
搜索chart | helm search CHARTNAME |
查看chart詳細信息 | helm inspect CHARTNAME |
安裝 | helm install --name mem1 stable/memcached [--dry-run] |
獲取狀態信息 | helm status mem1 |
列出release | helm list [-a] |
刪除release | helm delete [--purge] mem1 |
下載chart | helm fetch stable/redis |
建立chart | helm create CHARTNAME |
語法檢測 | helm lint CHARTNAME |
打包 | helm package CHARTNAME |
http://www.javashuo.com/article/p-zkxxbnhn-kc.html
https://jimmysong.io/kubernetes-handbook/practice/helm.htmlbash