Install and upgrade an app with Helm
In this task you'll install, upgrade and roll back an app as a Helm release.
Helm packages Kubernetes YAML as a chart: templates plus a values.yaml with the settings that change. Installing a chart makes a release with numbered revisions you can upgrade and roll back.
Change values, not templates: one chart, one values file per environment.
Example. Fernhill Cloud keeps one shop chart and three small values files (dev, test, prod); the pipeline runs helm upgrade --install with the right one.
Costs money. This task creates resources that are charged while they exist. Delete them as soon as you finish.
Before you start
You need: An AKS cluster. Time: 20 minutes.
Where to look
- helm create
- helm install
- helm upgrade
- helm history
- helm rollback
Steps
- Run
helm create shopand read shop/values.yaml. - Install:
helm install shop ./shop -n shop --create-namespace --set image.repository=mcr.microsoft.com/azuredocs/aks-helloworld --set image.tag=v1. - Upgrade:
helm upgrade shop ./shop -n shop --reuse-values --set replicaCount=3. helm history shop -n shop, andhelm rollback shop 1 -n shopto go back.
Commands
# Connect kubectl to the cluster first
az aks get-credentials -g <group> -n <cluster>
helm create shop
helm upgrade --install shop ./shop -n shop --create-namespace -f values-prod.yaml
helm history shop -n shop
helm rollback shop 1 -n shop
Watch out for
- Cost
- Uses the cluster you already pay for.
- Security
- Only use charts from sources you trust, and read what they install.
- Common mistakes
- Editing templates for one environment, and forgetting --reuse-values so an upgrade resets everything else.
Clean up
helm uninstall shop -n shop.
Words to know
- Chart
- A package of templated Kubernetes YAML.
- Release
- One installation of a chart, with a revision history.
- values.yaml
- The settings a chart exposes.
Tick off each step and track your progress in the guide.
Open this task in DevOps, Hands On