helm安裝 刪除


 

 

 
要安裝對應k8s版本的helm
tar -zxvf  helm-v2.10.0-linux-amd64.tgz
mv linux-amd64/ helm  /usr/local/bin/helm
 
或腳本安裝
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get > get_helm.sh
chmod 700 get_helm.sh
./get_helm.sh
安裝Tiller服務端
    helm init
 
 

遇到錯誤failed to list: configmaps is forbidden: User “system:serviceaccount:kube-system:default”

cannot list configmaps in the namespace “kube-system”

自Kubernetes 1.6版本開始,API Server啟用了RBAC授權。而目前的Tiller部署沒有定義授權的ServiceAccount,這會導致訪問API Server時被拒絕。
我們可以采用如下方法,明確為Tiller部署添加授權。
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"}}}}'
刪除helm tiller
kubectl delete deployment tiller-deploy -n k8s-tiller
kubectl delete service tiller-deploy -n k8s-tiller
kubectl delete -n=k8s-tiller rs tiller-deploy-6f65cf89

 helm是為了配置分離,

operator則是針對復雜應用的自動化管理

Helm Chart  : 應用包
安裝:  helm install <chart>
更新:  helm upgrade <release>
刪除:  helm delete <release>
創建chart:  helm create demoapp
chart結構:
      
         values.yaml:templates里面的文件從values文件中讀取出來的變量
         requirements:聲明子chart,和charts同時使用
        
 
使用另外的配置 ,覆蓋部分默認變量
     

Values.*的值可以來自以下 

+ Values.yaml文件 
     如果是子chart,值來自父chart的values.yaml 
+ 通過helm install -f標志的文件 
+ 來自–set中的配置

helm yaml語法

{{ .Values.* }} 
          從value.yaml文件中讀取 
{{ .Release.* }} 
          從運行Release的元數據讀取 
{{ .Template.* }}   {{ .Chart.* }} 
          從Chart.yaml文件中讀取 
{{ .Files.* }} 
        一、文件數量少情況下:
             在chart的根目錄下有三個文件
               
              在模板文件中使用
               
         二、文件多情況下:
                
{{ .Capabilities.* }}
 
 
{{quote }}
         {{ quote  .Values.favorite.drink }}
         是最常用的模板函數,它能把ABC轉化為“ABC”。它帶一個參數 
{{ template }}  {{ include  }}
     1、 先在_helpers.tpl中定義命名模板
      
     2、使用命名模版 
              
     3、渲染后 
                
 
{{ |default }} 
        drink: {{ .Values.favorite.drink | default “tea” | quote }} 
        如果在values中無法找到favorite.drink,則配置為“tea”。
{{  |indent }}
       {{ include "mychart_app" . | indent 2 }}
       對左空出空格
 在這個循環中使用.Values  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM