✦ For everyone, free.

Practical knowledge for real and everyday life

Home

Application Packaging Model

Helm's Application Packaging Model uses charts to define, deploy, and manage apps on Kubernetes with versioned, declarative releases.

Application Packaging Model defines a structured approach to bundle application components, configurations, and dependencies into a deployable and reusable package format, facilitating consistent application deployment and lifecycle management in container orchestration environments like Kubernetes. It abstracts the complexities of application configuration and deployment by providing a templated, versioned, and configurable package that can be shared, customized, and deployed across various environments.


Core Concepts

Package Components

An application package typically includes:

  • Chart Metadata: Descriptive information such as name, version, and dependencies.
  • Templates: Kubernetes manifest files written with templating directives to enable parameterization.
  • Default Values: Configuration parameters that can be overridden during deployment.
  • Charts Dependencies: References to other charts required for the application.
  • Additional Files: Documentation, scripts, and supporting files related to the application.

Reusability and Versioning

Packages are versioned artifacts that can be stored in repositories, enabling reuse across teams and environments. Versioning ensures consistent deployments by allowing users to specify exact package versions.

Parameterization and Overrides

The model supports parameterization through values files and command-line overrides, enabling customization of the application for different environments without modifying the package templates.


Structure of a Package

Chart.yaml

This is the metadata file containing:

  • name: Identifier of the package.
  • version: Semantic version of the package.
  • apiVersion: The version of the packaging specification.
  • description: Summary of the package purpose.
  • appVersion: The version of the application contained.
  • dependencies: List of dependent packages and their versions.

Example snippet:

apiVersion: v2
name: myapp
version: 1.2.3
appVersion: 4.5.6
description: A sample application
dependencies:
  - name: redis
    version: 14.8.8
    repository: "https://charts.bitnami.com/bitnami"

Templates Directory

Contains Kubernetes resource definitions using a templating language (Go templates). These templates dynamically render manifests based on provided values.

Example template file snippet (deployment.yaml):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Release.Name }}-myapp
spec:
  replicas: {{ .Values.replicaCount }}
  template:
    metadata:
      labels:
        app: {{ .Release.Name }}-myapp
    spec:
      containers:
      - name: myapp
        image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
        ports:
        - containerPort: {{ .Values.service.port }}

Values.yaml

Defines default configuration parameters for templates, enabling flexible customization.

Example:

replicaCount: 3
image:
  repository: myapp/image
  tag: "1.0.0"
service:
  port: 8080

Charts Directory

Holds dependent charts that are packaged alongside or referenced externally to compose complex applications from smaller components.


Packaging and Distribution

Packaging

The application package is bundled into a compressed archive (commonly .tgz), which contains all files and directories needed to deploy the application.

Packaging commands typically include:

helm package ./myapp

Repositories

Packages are stored and distributed via chart repositories, which are HTTP servers hosting an index of available packages.

Key repository operations:

  • Indexing: Creating or updating an index file listing available packages.
  • Hosting: Serving packages over HTTP(s).
  • Consuming: Installing packages directly from the repository.

Deployment and Lifecycle Management

Installation

Deploying the package to a Kubernetes cluster involves rendering templates with values and submitting the resulting manifests to the API server.

Example install command:

helm install myapp-release myapp-chart --values custom-values.yaml

Upgrades and Rollbacks

The model supports upgrade operations to apply new package versions or configuration changes while tracking release history for easy rollback.

Example upgrade command:

helm upgrade myapp-release myapp-chart --values updated-values.yaml

Rollback example:

helm rollback myapp-release 1

Uninstallation

Removing the deployed application and its resources cleanly from the cluster.

Example uninstall command:

helm uninstall myapp-release

Benefits of the Application Packaging Model

  • Consistency: Ensures uniform deployments across environments.
  • Automation-friendly: Integrates with CI/CD pipelines.
  • Modularity: Supports composing complex applications from smaller reusable packages.
  • Customization: Allows environment-specific configuration without changing templates.
  • Version Control: Tracks changes and enables controlled upgrades.
  • Sharing: Facilitates sharing and reuse through repositories.

Summary of Key Elements

ElementDescription
Chart.yamlMetadata and dependencies definition
TemplatesParameterized Kubernetes manifests
Values.yamlDefault configuration parameters
ChartsSub-packages or dependencies
Package ArchiveCompressed bundle of all components for distribution
RepositoryServer hosting packages for discovery and download

This model enables a standardized, scalable, and manageable approach to packaging and deploying applications within container orchestration platforms, promoting best practices and operational efficiency.