--- title: Introduction to Helm image: https://i.imgur.com/RmeDaRE.png --- <style> .alert-info img{ background-color: #fff0 } /* 僅指定連結的圖片去背且靠右模擬置中 */ img[src^="https://i.imgur.com/RmeDaRE.png"]{ position: relative; left: 40%; background-color: #fff0; } .title { color: #009933; font-weight:bold; } .highlight { color: #ff4d4d; font-weight:bold; border-bottom:2px red solid; padding-bottom:2px; } </style> :::warning # <center><i class="fa fa-book"></i> Introduction to Helm </center> ::: ###### tags: `study` `Kubernetes` ![](https://i.imgur.com/RmeDaRE.png =150x) <!-- <font class="highlight"> --> <!-- <font class="title"> --> <!-- 縮寫提示 --> <!-- *[O-RAN]:Open Radio Access Network --> :::success **🎯 Goals:** - [x] - <a href="#12-Helm-Architecture">To know Helm Architecture</a> - [x] - <a href="#Module-2-Basic-concept">To know the basic concept</a> - [x] - <a href="#Module-4-Summary">Summary </a> ::: :::info :bookmark: **Reference:** - [A more detailed comparison of Helm 3 and Helm 2](https://jakubstransky.com/2021/06/15/kubernetes-helm-operational-models/) - [Delet Namespace](https://phoenixnap.com/kb/helm-delete-deployment-namespace) --- :link: **++Links++ to my notes on the same topic** - [![](https://i.imgur.com/7DC4LFX.png =200x)](/@MingHung/Docker) &emsp;&emsp; [![](https://i.imgur.com/zeV3dSv.png =200x)](/@MingHung/Kubernetes) ::: [toc] # Module 1: Introduce ## 1.1 What is Helm - Helm is a suite for ==managing Kubernetes== applications. - Through the Helm Charts system, developers can package, install, and upgrade related Kubernetes applications. For these profiles: - Version control - Manage - Update - Effectively manage various versions of ==Yaml files==. ## 1.2 Helm Architecture ![](https://i.imgur.com/Ke7ijDg.png =500x) ### 1.2.1 Class relationship ![](https://i.imgur.com/tBSB8wa.png) <!-- ```graphviz digraph Kubernetes { rankdir = LR nodesep = 1.0 // increases the separation between nodes node [color=black,fontname="微軟正黑體",shape=box, style="rounded,filled", fillcolor=gray] //All nodes will this shape and colour edge [color=black, style=dashed] //All the lines look like this Namespace->Chart Chart->Release } ``` --> # Module 2: Basic concept ## 2.1 Main function (command) ### 2.1.1 List Helm - List Helm deployments in the **current namespace** with: ```cmd= helm list ``` - List Helm deployments all namespace with: (or select) ```cmd= helm list --all-namespaces helm list --namespace <namespace_name> kubectl get namespace ``` - search Helm by keyword ```cmd= helm search repo <KEY WORD> ``` ### 2.1.2 Delete 1. Delete All helm 2. There is no method to remove **namespace** when **deleting a release** using Helm commands. So using the **kubectl** command. ```cmd= helm delete peddling-hog kubectl delete <namespace name> ``` ## 2.2 OverView - Helm collectively refers to **++all++ Kubernetes applications (yaml)** as ==Charts==. - Helm's tool will **package these ++charts++** into ==tgz files== - For **applications installed into Kubernetes**, Helm calls it a ==Release (released object)==. ![](https://i.imgur.com/5rlWCZI.png =450x) ### 2.2.1 Chart in v2 - **Chart Architecture** ![](https://i.imgur.com/VPkpGLp.png) - `Chart.yaml`: Defines the Metadata of this Chart, including the Chart's version, name, description, etc. - `charts`: Folder. Put other Charts, called SubCharts. - `templates`: Defines the Kubernetes components required by this Chart service. (However, the parameters of each component will not be written in it, but will be substituted in the form of parameters.) - `values.yaml`: Define all parameters of this Chart, which will be substituted into the elements in templates. ![](https://i.imgur.com/MOrAg3j.png) ### 2.2.1 Chart in v3 - **Chart Architecture** ![](https://i.imgur.com/EKBR7CC.png) ## 2.3 Customized - Helm uses ==Go Template== to customize **Yaml** :::success - Example Yaml: ```yaml= apiVersion: v1 kind: Service metadata: name: {{ include "example.fullname" . }} labels: {{ include "example.labels" . | indent 4 }} spec: type: {{ .Values.service.type }} ports: - port: {{ .Values.service.port }} targetPort: http protocol: TCP name: http selector: app.kubernetes.io/name: {{ include "example.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} ``` - Use a large number of **`{{}}`** formats for variable substitution - Can make **Yaml** very **flexible** ::: # Module 3: Comparison ## 3.1 Helm v2 v.s Helm v3 - **In v2 architecture** ![](https://i.imgur.com/Jvms2FT.png =500x) - **v3 architecture is lightweight (compared to v2)** ![](https://i.imgur.com/T9LsRIM.png) ## 3.2 Helm 3 main differences ### 3.2.1 **v3 Remove Tiller** > Tiller server is used to communicate with API server and use chart to build services on k8s cluster :::success **v3 will eliminate the need to manage complex application releases in a shared cluster** ::: With Tiller gone, the security model for Helm is radically **simplified**. Helm 3 now supports all the modern **security**, **identity**, and **authorization** features of modern Kubernetes. - **Cluster administrators can restrict user permissions at whatever granularity they see fit.** > Helm's permissions are evaluated using your kubeconfig file. ### 3.2.2 The related apiVersion in the Helm Chart needs to **jump** from v1 to v2 to declare that the Helm Chart belongs to Helm v3. ### 3.2.3 **v3** uses a three-way comparison for testing, which will use the `past state`, `current operating state` and `expected state` to **compare**, and finally generate updated content. ### 3.2.4 With the support of **OCI**, the packaged format of Helm Chart in the future can follow the format of OCI (Open Contaianer Initiative). # Module 4: Summary The package manager for **Kubernetes**; Helm is the best way to **find, share, and use software built** for Kubernetes. ---- <!-- >**Name**: `名稱` -->