Skip to content

Package the Application

Helm uses a packaging format called charts. A chart is a collection of files that describe a related set of Kubernetes resources. A single chart might be used to deploy something simple, like a memcached pod, or something complex, like a full web app stack with HTTP servers, databases, caches, and so on. We need to package the deployments for our application into a Helm Chart.

We need to decide what Kubernetes resources are required for our application. A workload resource (deployment, statefulset) coupled with service and service account resource can be a good starting point.


  • Package your application for deployment on Stakater App Agility Platform (SAAP) into Helm Chart.

Key Results

  • Create helm chart in deploy/ folder.
  • Explore generic Application helm chart.


Create a Helm Chart with Application Chart

1. Create "deploy" directory

Create a directory named deploy/ in your repository that will contain the helm chart which will be deployed for our application.

mkdir deploy

2. Create Chart.yaml

Create A YAML file containing information about the chart called Chart.yaml.

touch Chart.yaml
apiVersion: v2
version: 1.0.0
dependencies: # A list of the chart requirements (optional)
  - name: application
    version: 2.1.13
appVersion: "0.0.0"

This dependency chart allows you to define resources without getting overwhelmed by the complexities of different resource with a simple interface. For a full list of configuration visit the chart repository here

3. Create values.yaml

Next create a values.yaml file for default configuration values for this chart. Lets start by defining values for deployment and service.

touch values.yaml
    applicationName: APP_NAME
      repository: NEXUS_DOCKER_REG_URL
      tag: 1.0.0
        enabled: true

4. Rebuild the charts

Run helm dependency build to rebuild or update the charts/ directory based on the Chart.lock file.

helm dependency build

5. View the generated resources

Run helm template . to view the resources generated.

helm template .

This chart will generate deployment, service account and service custom resources. This will highlight any other errors in the chart as well.

  # Source: CHART_NAME/charts/application/templates/serviceaccount.yaml
  apiVersion: v1
  kind: ServiceAccount
    name: APP_NAME
    namespace: default
    labels: application-2.1.13 Helm APP_NAME
  # Source: CHART_NAME/charts/application/templates/service.yaml
  apiVersion: v1
  kind: Service
    name: APP_NAME
    namespace: default
    labels: application-2.1.13 Helm APP_NAME
    type: "ClusterIP"
    selector: APP_NAME
      - name: http
        port: 8080
        protocol: TCP
        targetPort: 8080
  # Source: CHART_NAME/charts/application/templates/deployment.yaml
  apiVersion: apps/v1
  kind: Deployment
    labels: application-2.1.13 Helm APP_NAME
    annotations: "true"
    name: APP_NAME
    namespace: default
      matchLabels: APP_NAME
      type: RollingUpdate
        - name: APP_NAME
          image: repository/image-name
          imagePullPolicy: IfNotPresent
              memory: 256Mi
              cpu: 0.5
              memory: 128Mi
              cpu: 0.1
            readOnlyRootFilesystem: true
            runAsNonRoot: true
        serviceAccountName: APP_NAME

If you want to add resources that cannot be defined with dependency chart. You can simply add them in the templates/ folder.

Visit Stakater Nordmart Review Web and Stakater Nordmart Review API to see an example.

Package Stakater Nordmart Review

Consider the stakater-nordmart-review-api application that we containerized earlier.

1. Clone the repository

git clone
cd stakter-nordmart-review-api

2. go to deploy/ directory

cd deploy

In deploy/ directory you will see the Chart.yaml, values.yaml file and a templates directory.

3. Rebuild/update the charts

In deploy/ directory run helm dependency build.

helm dependency build

You will see the charts directory and a Chart.lock file has created.

4. View the generated resources

Run helm template . to view the resources generated.

helm template .

As you run the above command, the generated resources will be shown on the console.

You just packaged Stakater Nordmart Review Api application.

Copyright © 2023 Stakater AB – Change cookie settings