Helm 的安裝&打包

1. decompress helm package

百度雲Link:
https://pan.baidu.com/s/16avsZ3W5ym72g3YsR9RDqw
提取碼:r12o

tar -xzvf helm-v2.12.0-linux-amd64.tar.gz
cd linux-amd64 && mv helm /usr/bin/

2. helm init

由於 Helm 默認會去 storage.googleapis.com 拉取鏡像,如果你當前執行的機器不能訪問該域名的話可以使用以下命令來安裝:

# 使用阿里雲鏡像安裝並把默認倉庫設置爲阿里雲上的鏡像倉庫
$ helm init --upgrade --tiller-image registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.9.1 --stable-repo-url https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts

3.給 Tiller 授權

因爲 Helm 的服務端 Tiller 是一個部署在 Kubernetes 中 Kube-System Namespace 下 的 Deployment,它會去連接 Kube-Api 在 Kubernetes 裏創建和刪除應用。

而從 Kubernetes 1.6 版本開始,API Server 啓用了 RBAC 授權。目前的 Tiller 部署時默認沒有定義授權的 ServiceAccount,這會導致訪問 API Server 時被拒絕。所以我們需要明確爲 Tiller 部署添加授權。

---
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

kubectl apply -f tiller.yaml
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p ‘{“spec”:{“template”:{“spec”:{“serviceAccount”:“tiller”}}}}’

4. 驗證 Tiller 是否安裝成功

$ kubectl -n kube-system get pods|grep tiller
tiller-deploy-6d68f5c78f-nql2z          1/1       Running   0          5m

$ helm version
Client: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf666

5. Refeance

https://foxutech.com/what-is-helm/
https://whmzsu.github.io/helm-doc-zh-cn/chart/chart_repository-zh_cn.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章