Learnitweb

Introduction to Helm

What is Helm?

Helm is a package manager for Kubernetes that helps developers and DevOps teams manage, deploy, and scale Kubernetes applications efficiently. It simplifies the handling of Kubernetes manifest files by packaging related configurations into a reusable and shareable format known as Charts.

In a microservices architecture, managing numerous Kubernetes manifests for different services can be overwhelming. Helm addresses this complexity by enabling a structured and automated approach to Kubernetes deployment.

The Need for Helm

Without Helm, each microservice requires multiple Kubernetes manifest files for deployments, services, config maps, etc. Additionally, DevOps teams must manually apply, update, or delete these manifests using kubectl commands, making the process tedious and error-prone.

Challenges Without Helm

  1. Manual Management of Manifests – Each microservice needs its own set of YAML files.
  2. Repetitive Configurations – Most manifest files share a common structure, with only a few dynamic values.
  3. Difficult Updates and Rollbacks – Rolling back changes or upgrading services manually is cumbersome.
  4. Lack of Dependency Management – Kubernetes lacks a built-in way to manage dependencies between services.

Helm overcomes these challenges by introducing Charts, which package all related Kubernetes resources into a structured format that simplifies installation, upgrade, and rollback operations.

Helm Charts: The Core of Helm

A Chart in Helm is a collection of files that define a set of Kubernetes resources required to run an application. Helm Charts make it easy to deploy applications regardless of their complexity.

Benefits of Helm Charts:

  • Modular and Reusable – Charts allow developers to package Kubernetes applications into reusable components.
  • Simplifies Multi-Service Deployments – Instead of managing multiple YAML files, a single chart can encapsulate all required configurations.
  • Supports Dependencies – Charts can include child charts or dependent charts, allowing seamless integration with third-party services.

Example: Microservices Architecture with Helm

Imagine you have a microservices setup with accounts, loans, and cards services. Each service requires a Kubernetes Service object for networking. Without Helm, you would need separate manifest files for each service:

Traditional Kubernetes Service Manifests (Before Helm)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
apiVersion: v1
kind: Service
metadata:
name: accounts-service
spec:
selector:
app: accounts
ports:
- port: 8080
apiVersion: v1
kind: Service
metadata:
name: loans-service
spec:
selector:
app: loans
ports:
- port: 8081
apiVersion: v1 kind: Service metadata: name: accounts-service spec: selector: app: accounts ports: - port: 8080 apiVersion: v1 kind: Service metadata: name: loans-service spec: selector: app: loans ports: - port: 8081
apiVersion: v1
kind: Service
metadata:
  name: accounts-service
spec:
  selector:
    app: accounts
  ports:
    - port: 8080

apiVersion: v1
kind: Service
metadata:
  name: loans-service
spec:
  selector:
    app: loans
  ports:
    - port: 8081

Since most of these files share a common structure, Helm introduces a templating system to eliminate redundancy.

Helm Service Template (service.yaml)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.service.name }}
spec:
selector:
app: {{ .Values.service.app }}
ports:
- port: {{ .Values.service.port }}
apiVersion: v1 kind: Service metadata: name: {{ .Values.service.name }} spec: selector: app: {{ .Values.service.app }} ports: - port: {{ .Values.service.port }}
apiVersion: v1
kind: Service
metadata:
  name: {{ .Values.service.name }}
spec:
  selector:
    app: {{ .Values.service.app }}
  ports:
    - port: {{ .Values.service.port }}

Values File (values.yaml for Accounts Service)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
service:
name: accounts-service
app: accounts
port: 8080
service: name: accounts-service app: accounts port: 8080
service:
  name: accounts-service
  app: accounts
  port: 8080

Using these templates, Helm dynamically generates Kubernetes manifests at runtime, reducing redundancy and making deployment more efficient.

Helm as a Package Manager

A package manager helps install, uninstall, and upgrade software efficiently. Similar tools include:

  • Pip for Python
  • NPM for JavaScript
  • APT/YUM for Linux

Helm follows the same philosophy but for Kubernetes, making it the best way to find, share, and deploy Kubernetes applications.

Key Advantages of Helm

  1. Efficient Packaging
    • Helm bundles all Kubernetes manifests into a single Chart, which can be stored in a repository and shared with teams.
    • Helm Charts can be hosted in public or private Helm repositories, making distribution easier.
  2. Simplified Deployment and Management
    • Helm enables developers to install, upgrade, rollback, or uninstall entire microservice applications with a single command.
    • Unlike manually applying Kubernetes manifests, Helm ensures consistency and minimizes errors.
  3. Release and Version Management
    • Helm tracks application versions, allowing easy rollbacks to previous stable states.
    • Unlike Kubernetes’ built-in rollback feature, which only affects individual deployments, Helm allows rolling back entire Kubernetes clusters effortlessly.
  4. Automated Dependency Management
    • Helm allows you to define dependencies between services and third-party components.
    • Instead of manually installing supporting services like databases, message queues, or monitoring tools, Helm automates this process.