Working with Helm

Working with Helm in Thalassa Cloud Kubernetes

Helm is the standard package manager for Kubernetes, letting you package, configure, and deploy applications as reusable “charts.” Using Helm in Thalassa Cloud Kubernetes helps you easily install and manage applications—including their updates and configuration—by leveraging thousands of ready-made or custom charts.

With Helm, instead of applying separate YAML files for deployments, services, and configs, you use a single chart that describes all necessary resources together. Charts are collections of templates and configuration values, so you can reuse and customize them for different environments.

Helm works through a simple CLI. In Helm 3 there’s no need for any server-side component in your cluster. When you install a chart, Helm fills in the templates using your values, creates the final Kubernetes manifests, and applies them to your cluster. Helm also keeps track of what it installed, so you can easily upgrade, roll back, or uninstall applications as needed.

Installing Helm

Before you can use Helm, you need to install the Helm CLI on your local machine. The installation process varies by operating system, but it’s straightforward on all platforms.

On macOS, the easiest way is using Homebrew:

brew install helm

On Linux, you can download the binary directly or use a package manager. To download the binary:

curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

For Windows, download the binary from the Helm releases page or use a package manager like Chocolatey:

choco install kubernetes-helm

Verify the installation by checking the Helm version:

helm version

You should see version information for Helm 3. Helm 3 doesn’t require any cluster-side components, so once the CLI is installed, you’re ready to use Helm with your Thalassa Cloud Kubernetes cluster.

Configuring Helm for Your Cluster

To use Helm with your Thalassa Cloud Kubernetes cluster, ensure you have cluster access configured. Use tcloud kubernetes connect to configure access, or set up kubeconfig manually. See the Getting Started guide for details.

Verify that Helm can access your cluster:

helm list

This command lists all Helm releases in your cluster. If it works without errors, Helm is correctly configured and can communicate with your cluster.

Helm uses your current kubectl context to determine which cluster to work with. If you have multiple clusters configured, ensure you’re using the correct context:

kubectl config current-context

Switch contexts if needed:

kubectl config use-context <context-name>

Or use tcloud kubernetes connect to switch to the correct cluster.

Working with Helm Charts

Helm charts are available from various sources, including the official Helm chart repository and third-party repositories. The most common way to find and install charts is through the Helm Hub or by adding chart repositories.

Search for charts using the Helm search command:

helm search hub nginx

This searches the Helm Hub for nginx-related charts. The results show available charts with descriptions and links to their documentation.

To install a chart from the Helm Hub, first add the repository. For example, to add a chart repository:

helm repo add example-repo https://charts.example.com
helm repo update

The repo add command adds a chart repository to your local Helm configuration. The repo update command downloads the latest chart information from all configured repositories.

List available charts in a repository:

helm search repo example-repo/nginx

This shows nginx charts available in the repository, along with their versions and descriptions.

Installing a Helm Chart

Installing a Helm chart creates a Helm release—an instance of a chart deployed to your cluster. You can install charts with default values or customize them using a values file or command-line flags.

Install a chart with default values:

helm install my-nginx example-repo/nginx

This installs the nginx chart from the repository, creating a release named “my-nginx”. Helm processes the chart templates and creates the necessary Kubernetes resources.

Check the status of your release:

helm list
helm status my-nginx

The list command shows all Helm releases in your cluster. The status command provides detailed information about a specific release, including what resources were created and their current state.

View the values that were used for the installation:

helm get values my-nginx

This shows the configuration values that were applied when the chart was installed. You can use this to understand how the chart was configured and to create custom values files for future installations.

Customizing Chart Values

Most Helm charts support extensive customization through values files. Values files are YAML files that override default chart values, allowing you to configure charts for your specific needs.

Get the default values for a chart:

helm show values example-repo/nginx > nginx-values.yaml

This downloads the default values file, which you can edit to customize the chart. Open the file and modify values as needed. For example, you might change the service type to use a LoadBalancer:

service:
  type: LoadBalancer
  ports:
    http: 80

Install the chart with your custom values:

helm install my-nginx example-repo/nginx -f nginx-values.yaml

The -f flag specifies a values file to use. You can also override individual values using the --set flag:

helm install my-nginx example-repo/nginx --set service.type=LoadBalancer

For complex configurations, values files are generally easier to manage than multiple --set flags. Values files can also be version-controlled, making it easier to track configuration changes.

Upgrading and Rolling Back

Upgrading a Helm release is simple. Use helm upgrade to apply new values or move to a new chart version:

helm upgrade my-nginx example-repo/nginx -f nginx-values.yaml

To upgrade to a specific version:

helm upgrade my-nginx example-repo/nginx --version 15.0.0

If something goes wrong, roll back to a previous version:

helm rollback my-nginx

To roll back to a specific revision:

helm rollback my-nginx 2

See release history:

helm history my-nginx

Creating Your Own Charts

While there are thousands of pre-built charts available, you may want to create your own charts for applications specific to your organization. Creating charts allows you to package your applications in a reusable, versioned format.

Create a new chart:

helm create my-app

This creates a directory structure with template files and a values file. The structure includes:

my-app/
  Chart.yaml          # Chart metadata
  values.yaml         # Default values
  templates/          # Kubernetes manifest templates
    deployment.yaml
    service.yaml
    _helpers.tpl       # Template helpers

Edit the templates to define your application. Templates use Go template syntax and can reference values from the values.yaml file. For example, a deployment template might reference the image name:

spec:
  containers:
  - name: {{ .Chart.Name }}
    image: {{ .Values.image.repository }}:{{ .Values.image.tag }}

Set default values in values.yaml:

image:
  repository: my-app
  tag: "1.0.0"

replicaCount: 3

service:
  type: ClusterIP
  port: 80

Test your chart before installing:

helm lint my-app
helm template my-app

The lint command checks for common issues. The template command renders the templates without installing, allowing you to see what would be created.

Install your chart:

helm install my-app ./my-app

This installs the chart from the local directory. You can also package the chart for distribution:

helm package my-app

This creates a .tgz file that can be shared or added to a chart repository.

Further Reading

To learn more about Helm, Kubernetes application deployment, and Thalassa Cloud features, explore the following resources: