Cloud Native 22 min read

Master Helm: A Complete Guide to Kubernetes Package Management and Deployment

This comprehensive tutorial explains Helm, the Kubernetes package manager, covering core concepts, workflow, differences between Helm 3 and Helm 2, installation steps, repository handling, chart structure, custom chart creation, deployment, upgrade, rollback, and integration with Harbor, providing practical commands and examples.

Raymond Ops
Raymond Ops
Raymond Ops
Master Helm: A Complete Guide to Kubernetes Package Management and Deployment

Concepts

Helm is the package manager for Kubernetes. It uses Charts (collections of YAML files) to define, package, and deploy applications. A Release is an instance of a Chart deployed in a cluster.

Helm's official website provides installation guides, documentation, chart repositories, and community contributions.

Helm Core Concepts

Chart : a package of Kubernetes resources.

Repository : a storage location for Charts.

Release : a deployed instance of a Chart.

Helm Workflow

Find Chart : search in repositories.

Install Chart : helm install to deploy.

Manage Release : helm upgrade, helm rollback, helm uninstall.

Maintain Repository : add, update, remove repos.

Helm 3 vs Helm 2

Helm 2 uses a server component called Tiller; Helm 3 removes Tiller and communicates directly with the Kubernetes API, simplifying architecture and improving security.

Helm Deployment

Install Helm

Download Helm client

Visit the Helm GitHub releases page and download the appropriate binary for your OS.

tar -zxvf helm-v3.6.0-linux-amd64.tar.gz
mv linux-amd64/helm /usr/local/bin/helm
Helm version output
Helm version output

Verify installation

# helm version
helm version

Enable command completion

# echo "source <(helm completion bash)" >> ~/.bashrc

Use Helm to install a Chart

Add repositories

helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add stable http://mirror.azure.cn/kubernetes/charts
helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
helm repo add incubator https://charts.helm.sh/incubator

Update repositories

helm repo update

List repositories

helm repo list
Helm repo list
Helm repo list

Search Chart information

helm show chart stable/mysql
helm show all stable/mysql

Install Chart

helm install my-redis bitnami/redis
helm install bitnami/redis --generate-name

List releases

helm ls
helm list

Check release status

helm status my-redis

Delete release

helm uninstall my-redis

Helm Chart Custom Templates

Inspect Chart files

Charts consist of Chart.yaml, values.yaml, and a templates directory containing resource definitions such as Deployments, Services, Ingress, ConfigMaps, Secrets, etc.

Chart structure example

mychart/
├── Chart.yaml
├── README.md
├── templates/
│   ├── deployment.yaml
│   ├── service.yaml
│   └── ...
└── values.yaml
Chart file tree
Chart file tree

Create a custom Chart

helm create nginx
tree nginx

Edit Chart.yaml to set metadata (name, version, description) and modify values.yaml to configure parameters such as image repository, tag, service type, ingress settings, resources, etc.

Package and deploy custom Chart

helm lint nginx
helm package nginx
helm install nginx ./nginx --dry-run --debug
helm install nginx ./nginx -n default

Deploy Ingress Nginx

wget https://gitee.com/mirrors/ingress-nginx/raw/nginx-0.30.0/deploy/static/mandatory.yaml
wget https://gitee.com/mirrors/ingress-nginx/raw/nginx-0.30.0/deploy/static/provider/baremetal/service-nodeport.yaml
kubectl apply -f mandatory.yaml
kubectl apply -f service-nodeport.yaml

Upgrade Chart (NodePort example)

# modify values.yaml: set service.type to NodePort and define nodePort
helm upgrade nginx nginx

Rollback

Rollback a Release

helm history nginx
helm rollback nginx 1
helm history nginx

Maintain Chart.yaml and values.yaml for updates. Use the --set flag to override values without editing values.yaml:

helm upgrade nginx nginx --set image.tag='1.15'

Helm Repository with Harbor

Install Harbor

# download and extract harbor-offline-installer
# edit harbor.yml (hostname, admin password, data volume, enable chartmuseum)
./install.sh --with-clair --with-chartmuseum

Install Helm Push plugin

helm plugin install https://github.com/chartmuseum/helm-push

Configure Helm repository

helm repo add harbor http://192.168.241.24/chartrepo/chart_repo --username=admin --password=Harbor12345

Push Chart to Harbor

helm push nginx harbor

Helm Command Summary

Key Helm commands

completion : enable command completion.

create : create a new chart.

dependency : manage chart dependencies.

env : show Helm environment information.

get : retrieve extended information about a release.

help : display help for commands.

history : view release revision history.

install : deploy a chart as a release.

lint : validate chart syntax.

list (or ls ): list installed releases.

package : package a chart into a tgz archive.

plugin : manage Helm plugins (install, list, uninstall).

pull : download a chart from a repository.

repo : add, list, remove, update chart repositories.

rollback : revert a release to a previous revision.

search : search for charts in repositories.

show : display detailed chart information.

status : show the status of a release.

template : render chart templates locally.

test : run tests for a release.

uninstall : delete a release.

upgrade : upgrade an existing release.

verify : verify chart signatures.

version : display Helm client version.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Kubernetespackage managementhelmchart
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.