Helm Architecture
In this lesson, we will explore the architecture of Helm, focusing on its core components and how they work together to manage Kubernetes applications. Understanding Helm's architecture is crucial for effectively using Helm to deploy, upgrade, and manage applications within Kubernetes clusters.
Key Components of Helm
Helm’s architecture revolves around a few key components that work together to simplify the management of Kubernetes applications:
Helm CLI (Command-Line Interface)
Helm Charts
Helm Repositories
Helm Releases
1.2.1.1 Helm CLI (Command-Line Interface)
The Helm CLI is the primary tool that users interact with when managing applications in Kubernetes. It is used to install, upgrade, delete, and manage Helm charts and releases. The CLI communicates with the Kubernetes API to apply the necessary changes to the cluster.
Key Functions of Helm CLI:
helm install: Deploys a chart as a new release.
helm upgrade: Upgrades an existing release to a new version of a chart.
helm rollback: Rolls back a release to a previous version.
helm list: Lists all the current releases in the Kubernetes cluster.
helm uninstall: Removes a release from the cluster.
1.2.1.2 Helm Charts
Helm charts are the heart of Helm's architecture. A chart is a package that contains all the resource definitions necessary to deploy an application or a set of related applications. It includes templates, configuration files, and dependencies.
Key Components of a Helm Chart:
Chart.yaml: Contains metadata about the chart, such as its name, version, and description.
values.yaml: Defines the default configuration values for the chart. These values can be overridden during installation.
Templates: A directory containing Go templates that define the Kubernetes resources. These templates are rendered with the values provided in
values.yaml
or by the user.Charts: A directory that can contain dependencies or sub-charts.
1.2.1.3 Helm Repositories
Helm repositories are collections of Helm charts that are stored and shared publicly or privately. Repositories make it easy to distribute and version Helm charts.
Key Features of Helm Repositories:
Public Repositories: Helm has several public repositories, such as Artifact Hub, where users can find and download charts for various applications.
Private Repositories: Organizations can set up private Helm repositories to store and manage internal charts.
Repository Commands: Helm CLI provides commands like
helm repo add
,helm repo update
, andhelm repo list
to manage repositories.
1.2.1.4 Helm Releases
A Helm release is an instance of a chart running in a Kubernetes cluster. Each time you deploy a chart using the helm install
command, Helm creates a release.
Key Characteristics of Helm Releases:
Versioning: Releases are versioned, which allows for easy upgrades and rollbacks.
State Management: Helm maintains the state of each release, storing details like the chart version, Kubernetes resources created, and configuration values used.
Naming: Each release has a unique name, either provided by the user or generated by Helm, which is used to manage and track the release.
1.2.2 Helm v3 Architecture
Helm v3 is the current and recommended version of Helm. It introduced several architectural changes from Helm v2, the most significant being the removal of Tiller.
1.2.2.1 Removal of Tiller
In Helm v2, Tiller was a server-side component that managed releases within the Kubernetes cluster. However, Tiller introduced security concerns, as it required elevated permissions and exposed a potential attack surface within the cluster.
Changes in Helm v3:
Client-Side Operations: Helm v3 performs all operations client-side, directly interacting with the Kubernetes API. This simplifies the architecture and eliminates the need for Tiller.
Security: By removing Tiller, Helm v3 enhances security by reducing the need for elevated permissions. All operations are performed using the user's existing Kubernetes credentials.
Simplified Architecture: The removal of Tiller simplifies Helm’s architecture, making it easier to use and deploy, especially in production environments.
1.2.3 Interaction with Kubernetes API
Helm interacts with the Kubernetes API to manage the resources defined in Helm charts. When a user runs a Helm command (e.g., helm install
), the Helm CLI processes the chart, renders the templates, and sends the corresponding API requests to Kubernetes.
Key Interactions:
Resource Creation: Helm creates Kubernetes resources (like Pods, Services, and ConfigMaps) based on the templates in the chart.
Resource Management: Helm can update or delete resources as part of an upgrade, rollback, or uninstall operation.
Status Monitoring: Helm tracks the status of the resources it manages, allowing users to monitor the health and status of their releases.
1.2.4 Hands-on Example: Deploying a Sample Chart
Let’s walk through a simple example to understand how Helm interacts with the Kubernetes cluster:
Install Helm: Ensure Helm is installed and configured to work with your Kubernetes cluster.
Add a Repository: Add a repository containing Helm charts.
Install a Chart: Install a sample chart from the repository.
Observe the Release: Use Helm CLI to list the release and check its status.
Upgrade the Release: Upgrade the release with custom values.
Rollback the Release: Rollback the release to a previous version if needed.
1.2.5 Summary
Helm's architecture is designed to simplify Kubernetes application management by providing a robust, flexible, and secure toolset. With Helm CLI, charts, repositories, and releases, you can manage Kubernetes applications efficiently and effectively. The transition to Helm v3 has further enhanced security and usability by removing Tiller and streamlining operations.
Last updated