Skip to main content

Manage Helm charts using Container Registry

Learn how to store and deploy Helm charts using Container Registry.

info

About this scenario​

This scenario explains how to manage and deploy Helm charts in a Kubernetes cluster using Container Registry. Helm is a Kubernetes package manager that simplifies the deployment and management of complex applications.

Key topics include:

  • Create a repository in Container Registry and upload Helm charts
  • Create a basic Helm chart for an Nginx web server
  • Deploy Helm charts in a Kubernetes cluster
  • Manage and upgrade Helm chart versions

Before you start​

To proceed smoothly, create a Container Registry and Kubernetes cluster, and install the required tools.

1. Create Container Registry​

Container Registry is a cloud service for centrally storing and managing application packages (e.g., Docker images or Helm charts). This step involves creating a repository to store Helm charts.

  1. Go to the KakaoCloud console > Container Registry menu and create a repository with the following settings:

    ItemRepository setting
    VisibilityPrivate
    Repository nametutorial-helm-cr
    Tag overwriteEnabled
    Image scanAutomatic
  2. Verify that the repository is successfully created in the Container Registry.

2. Create Kubernetes cluster​

Create a Kubernetes cluster for the practice session. Refer to the Set up Kubernetes cluster with Kubernetes Engine guide and complete Step 2. Call Kubernetes API with kubectl.

3. Install required tools​

For MacOS, install the following tools:

  1. Install Helm, the Kubernetes package manager for easy application deployment and management.

    brew install helm
  2. Install Docker Desktop, a tool for container execution and image management.

    brew install --cask docker
  3. Install the Tree utility, which visually displays directory structures, useful for exploring Helm chart structures.

    brew install tree

Getting started​

This practice session guides you through creating a Helm chart, configuring namespaces, deploying the chart, and managing it with Container Registry.

Step 1. Create Helm chart​

Helm charts package Kubernetes resources into reusable templates. This step creates a basic Helm chart for an Nginx web server.

  1. Create a basic Helm chart.

    helm create my-nginx
  2. Check the directory structure.

    tree my-nginx

    The following directory structure should appear:

    my-nginx/
    ├── Chart.yaml
    ├── charts
    ├── templates
    │ ├── NOTES.txt
    │ ├── _helpers.tpl
    │ ├── deployment.yaml
    │ ├── hpa.yaml
    │ ├── ingress.yaml
    │ ├── service.yaml
    │ ├── serviceaccount.yaml
    │ └── tests
    │ └── test-connection.yaml
    └── values.yaml
  3. Modify the values.yaml file by setting serviceAccount.create to false. This tutorial does not require a dedicated service account.

Step 2. Create namespace and deploy chart​

In this step, create a namespace to logically separate resources and deploy the Helm chart created earlier.

  1. Create a new namespace.

    kubectl create ns helm-space
  2. Deploy the Helm chart.

    cd ~/my-nginx
    helm install my-nginx-release ../my-nginx/ --debug --namespace helm-space
  3. Verify the deployment status.

    kubectl get all -n helm-space ## Verify deployed resources
    helm list --all --namespace helm-space ## Check chart status
    Example output
    NAME             NAMESPACE   REVISION  UPDATED                               STATUS    CHART          APP VERSION
    my-nginx-release helm-space 1 2025-01-03 16:53:29.378136 +0900 KST deployed my-nginx-0.1.0 1.16.0

Step 3. Authenticate Container Registry​

Authenticate the Helm registry to access the Container Registry.

helm registry login ${PROJECT_NAME}.kr-central-2.kcr.dev \
--username ${ACCESS_KEY_ID} \
--password ${SECRET_KEY}
VariableDescription
PROJECT_NAME🖌︎ KakaoCloud project name
ACCESS_KEY_ID🖌︎Access key ID
SECRET_KEY🖌︎Secret access key

Step 4. Package and upload chart​

Package and upload the Helm chart to the Container Registry.

  1. Package the chart.

    helm package my-nginx
  2. Upload the packaged chart to the Container Registry.

    • In this scenario, the repository name is fixed as tutorial-helm-cr.
    helm push my-nginx-0.1.0.tgz oci://${PROJECT_NAME}.kr-central-2.kcr.dev/tutorial-helm-cr
    VariableDescription
    PROJECT_NAME🖌︎ KakaoCloud project name
  3. Verify the uploaded chart and version (0.1.0) in KakaoCloud console > Container Registry > tutorial-helm-cr > my-nginx.

Step 5. Upgrade chart version​

Modify the Helm chart settings and deploy a new version.

  1. In values.yaml, set replicaCount to 2 to increase the number of Pod replicas.

  2. Update the version in Chart.yaml to 0.1.1 and package the chart.

    helm package my-nginx
  3. Upload the new version to the Container Registry.

    helm push my-nginx-0.1.1.tgz oci://${PROJECT_NAME}.kr-central-2.kcr.dev/tutorial-helm-cr
    VariablesDescription
    PROJECT_NAME🖌︎ KakaoCloud project name
  4. Verify the uploaded chart and version (0.1.1) in KakaoCloud console > Container Registry > tutorial-helm-cr > my-nginx.

  5. Upgrade the deployed chart to the new version.

    helm upgrade my-nginx-release oci://${PROJECT_NAME}.kr-central-2.kcr.dev/tutorial-helm-cr/my-nginx --version 0.1.1 --namespace helm-space
    VariablesDescription
    PROJECT_NAME🖌︎ KakaoCloud project name
  6. Verify the upgrade.

    kubectl get all -n helm-space ## Check that Pod count is 2
    helm history my-nginx-release --namespace helm-space ## View chart upgrade history

    Example output

    REVISION	UPDATED                 	STATUS    	CHART         	APP VERSION	DESCRIPTION
    1 Fri Jan 3 16:53:29 2025 superseded my-nginx-0.1.0 1.16.0 Install complete
    2 Fri Jan 3 17:28:32 2025 deployed my-nginx-0.1.1 1.16.0 Upgrade complete

Cleanup​

Run the following commands to clean up the resources created during this session.

helm uninstall my-nginx-release --namespace helm-space
kubectl delete namespace helm-space