[k8s] Helm ============== ###### tags: `kubernetes` :::info + Helm 是 Kubernetes 的***部署管理工具***(不僅僅是包管理器 package manager)。它對可重複部署、依賴項管理(重用和共享)、多配置管理、更新、回滾和測試應用程式部署(版本)等方面做了大量工作。 + 可以幫助開發者打包,安裝,升級相關的 Kubernetes 應用程式 ::: # info Helm 是 Kubernetes Chart 的管理工具,Kubernetes Chart 是一套`預先組態`的 Kubernetes `資源套件`。使用 Helm 有以下幾個好處: 1. 查詢與使用熱門的 Kubernetes Chart 軟體套件。 2. 以 Kuberntes Chart 來分享自己的應用程式。 3. 可利用 Chart 來重複建立應用程式。 4. 智能地管理 Kubernetes manifest 檔案。 5. 管理釋出的 Helm 版本。 > a deployment tool in the Kubernetes world >> [color=purple] **a tool is used on top of kubectl** # concept Helm 的架構概念就是將整包 Kubernetes 的***所有資源物件***再疊加一層***抽象層***,這個抽象層是給 Helm 工具使用的,Helm 的工具會有自己的方式去**解讀**這個抽象層,==最後產生出最後的 Kubernetes 資源物件然後安裝到 Kubernetes 裡面== + ==Chart==:主要定義要被執行的應用程式中,所需要的工具、資源、服務等資訊,有點類似 Homebrew 的 Formula 或是 APT 的 dpkg 檔案。 + 將所有 Kubernetes 的應用程式都統稱為 Charts + ==Release==:一個被執行於 Kubernetes 的 Chart 實例。Chart 能夠在一個叢集中擁有多個 Release,例如 MySQL Chart,可以在叢集建立基於該 Chart 的兩個資料庫實例,其中每個 Release 都會有獨立的名稱。 + 安裝到 Kubernetes 中的應用程式, Helm 稱其為 Release + ==Repository==:主要用來存放 Chart 的倉庫,如 KubeApps。 + ==Config==:利用config來進行 Yaml 的客製化 > Helm 本身會需要`存取 Kubernetes 叢集`,所以也是使用 ==KUBECONFIG== 等方式來設定存取權限 # inside the charts > [color=red]**resource templates + values = chart** ## chart.yaml # command line ```shell= helm install [RELEASE-NAME] [CHART-NAME] [flags] ``` ```shell= helm repo list helm repo add stable https://charts.helm.sh/stable helm search repo stable helm repo update helm ls -a ``` ```shell= helm search repo wordpress helm search hub wordpress ``` ```shell= helm show values bitnami/apache | grep replicaCount -B2 ``` ```shell= helm install chart-dev . --namespace chart-dev --create-namespace -f values/dev.yaml helm install chart-prod . --namespace chart-prod --create-namespace -f values/prod.yaml helm uninstall ${release_name} ``` ```shell= helm package square-one ``` ```shell= helm upgrade my-apache bitnami/apache --version 8.0.3 helm rollback my-apache 1 ``` ```shell= helm install wordpress bitnami/wordpress --set serviceType=LoadBalancer --set image.registry="MY-REGISTRY.azurecr.io" --set image.pullSecrets={MY-ACR-AUTH} --set image.repository=bitnami/wordpress --set image.tag=latest ``` # others 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up