技術工作坊系列——認識Helm

還在煩惱怎麼管理日益複雜的Kubernetes YAML檔嗎?Helm或許是你尋尋覓覓許久的解決方案

James Shieh
Nov 1 · 7 min read
技術工作坊系列文章希望幫助工程師降低學習新技術的成本,我們用最基本的知識讓您有足夠的資訊判斷該不該跳坑學習新技術?我明白你學習新技術的心情:
IT產業日新月異,當我們被接踵而來的新技術淹沒時,變得戒慎恐懼,明白生命該浪費在美好的事物上,卻也擔心過於保守而錯過發現美好的可能性,該如何是好?無論你對新技術的出現是興奮還是厭倦,你都不得不跨出一步,才能知道他對你是否有幫助,我們希望幫你把這一步走完,也走得輕鬆。
*每篇文章都會選定一個主題,盡可能限縮需要學習的知識,讓您用最少的時間掌握關鍵知識。
*在深入正文前,請務必閱讀服用須知,以免浪費您寶貴的時間。
Photo by Andrew Neel on Unsplash

服用須知

為什麼要使用Helm?

Helm如何幫助我們管理Kubernetes應用程式?

該如何安裝Helm?

我沒有Kubernetes Cluster環境怎麼辦?如果你想在幾分鐘內快速建立一個Cluster,可以參考:https://medium.com/@jamesshieh0510/%E5%88%A9%E7%94%A8gcp%E5%BB%BA%E7%AB%8Bkubernetes-cluster-83c89ec10ee7利用GCP建立Cluster後,安裝gcloud工具可以讓你在自己的電腦上訪問GCP:https://medium.com/@jamesshieh0510/%E5%9C%A8mac%E4%B8%8A%E5%AE%89%E8%A3%9Dgcp-cloud-sdk-1ad7f5fb4275
touch ./rbac-for-helm.yaml
cat <<EOF | sudo tee ./rbac-for-helm.yaml
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
EOF
kubectl create -f ./rbac-for-helm.yaml
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'

如何使用Helm?

如果你覺得helm值得深入了解,想知道目錄結構中的各個檔案該如何使用,可以參考這篇:https://helm.sh/docs/developing_charts/#charts
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=hello-helm,app.kubernetes.io/instance=eloping-ibex" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80

使用Helm的益處

Reference:

技術保鮮盒

分享技術學習、接案經驗、團隊領導、專案管理等技巧與觀念

James Shieh

Written by

熱愛閱讀與學習的接案工作者——斜槓恰好是除法符號,把那些頭銜都放在了分母,實際上擺在分子的數字才決定了質與量。

技術保鮮盒

分享技術學習、接案經驗、團隊領導、專案管理等技巧與觀念

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade