Helm Fundamentals
Explore Helm fundamentals, ArtifactHub, Helm repositories, chart installation, dependency management, setting values, and release upgrades.
Helm Fundamentals: Managing Kubernetes Deployments with Helm
Helm is the de facto package manager for Kubernetes, simplifying application deployment and management.
Exploring ArtifactHub and Helm Repositories
- ArtifactHub is a central repository where users can discover and share Helm charts, operators, and other Kubernetes resources.
- It allows users to browse and search for Helm charts maintained by the community and official providers.
- Visit ArtifactHub to explore available charts and their documentation.
Managing Helm Repositories with the Helm CLI ⚙️
- Helm repositories store and distribute Helm charts.
The default Helm repository is Helm’s official stable repository, but users can add custom repositories.
Adding a Helm Repository
1
helm repo add bitnami https://charts.bitnami.com/bitnami
Listing Available Repositories
1
helm repo list
Updating the Helm Repository
1
helm repo update
Installing Charts ⚡
- Installing the WordPress Helm Chart
Let’s install the WordPress Helm chart from the Bitnami repository:
1
helm install my-wordpress bitnami/wordpress
This deploys WordPress in a Kubernetes cluster with default configurations.
- Exploring the Default WordPress Chart Configuration
After installation, you can check the installed resources:
1
kubectl get all
To inspect the default configuration:
1
helm show values bitnami/wordpress
Uninstalling Helm Charts and Cleaning Up Resources
To uninstall the WordPress deployment:
1
helm uninstall my-wordpress
This removes the release but not persistent volumes. To delete all associated resources, manually remove PVCs:
1
kubectl delete pvc --all
Managing Chart Dependencies ⚙️
- Helm charts can have dependencies on other charts, defined in the Chart.yaml file.
To manage dependencies:
Adding Dependencies to Chart.yaml
1 2 3 4
dependencies: - name: mysql version: "8.0.0" repository: "https://charts.bitnami.com/bitnami"
Updating Dependencies⚡
Run the following command to fetch and update dependencies:
1
helm dependency update
Setting Values
- Setting Custom Values via the Helm CLI
You can override default values while installing a chart: ⚙️️
1
helm install my-wordpress bitnami/wordpress --set wordpressUsername=admin,wordpressPassword=secret
- Setting Custom Values via Files ✍️
Instead of passing values in CLI, store them in a file:
1 2
wordpressUsername: admin wordpressPassword: secret
Install the chart with:
1
helm install my-wordpress bitnami/wordpress -f custom-values.yaml
Release Upgrades and Rollbacks ⏳
Upgrading Helm Releases: Setting New Values ⚙️
Modify values and upgrade the release:
1
helm upgrade my-wordpress bitnami/wordpress --set wordpressEmail=admin@example.com
Upgrading Helm Releases: Setting New Chart Versions
To upgrade to a specific version:
1
helm upgrade my-wordpress bitnami/wordpress --version 10.1.0
Rollbacks in Helm ⏪
If an upgrade fails, roll back to a previous version:
1
helm rollback my-wordpress 1
Check revision history with:
1
helm history my-wordpress
Upgrading Helm Releases: Useful CLI Flags⚡
--atomic
: Rollback automatically if the upgrade fails.--dry-run
: Preview changes before applying.--debug
: Get detailed error logs.Example:
1
helm upgrade my-wordpress bitnami/wordpress --set wordpressTitle="My Blog" --atomic --debug
Conclusion
Helm simplifies Kubernetes deployments, allowing users to manage applications efficiently. From discovering charts on ArtifactHub to managing values, dependencies, and rollbacks, Helm provides powerful tools to streamline Kubernetes operations. ⚡
Try out Helm in your cluster and explore its potential!