kubernetes包管理工具h(yuǎn)elm和tiller的安裝

1.先決條件本地的kubectl 可以連接到遠(yuǎn)程的k8s

2.下載helm->參考

linux amd64

3.安裝helm

tar -zxvf helm-v2.11.0-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm
#helm help驗(yàn)證安裝成功

4. 添加tiller到 [k8s] service account

#vim serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: tiller
  namespace: kube-system
#:wq保存
#kubectl apply -f serviceaccount.yaml

kubectl create serviceaccount --namespace kube-system tiller
# vim clusterrolebinding.yaml
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
#:wq保存
#kubectl apply -f clusterrolebinding.yaml

kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller

5.用阿里云tiller鏡像及tiller賬戶初始化helm, 將tiller部署到[k8s] deployment下.

helm init --service-account tiller --upgrade --tiller-image=registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.11.0
#若您已經(jīng)在k8s部署了tiller則只需要執(zhí)行
helm init  --client-only
#vim ~/.helm/repository/repositories.yaml
apiVersion: v1
generated: 2018-11-10T20:32:27.187074383+08:00
repositories:
- caFile: ""
  cache: /root/.helm/repository/cache/stable-index.yaml
  certFile: ""
  keyFile: ""
  name: stable
  password: "password"
  url: https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
  username: "username"
- caFile: ""
  cache: /root/.helm/repository/cache/local-index.yaml
  certFile: ""
  keyFile: ""
  name: local
  password: ""
  url: http://127.0.0.1:8879/charts
  username: ""

6.檢查tiller是否部署到[k8s]

kubectl get pod -n kube-system -l app=helm

7.用helm示例測試

#創(chuàng)建一個chart范例
helm create helm-chart
#檢查chart語法
helm lint ./helm-chart
#使用默認(rèn)chart部署到k8s
helm install --name example1 ./helm-chart --set service.type=NodePort
#kubectl get pod 查看是否部署成功
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容