Skip to content

Commit

Permalink
Add package management with helm explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
berkayoz committed Jan 15, 2025
1 parent f47c539 commit 0975d1b
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/snap/explanation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ epa
high-availability
security
cis
package-management
```

---
Expand Down
95 changes: 95 additions & 0 deletions docs/src/snap/explanation/package-management.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Package management with Helm

There are multiple ways of installing and managing packages on Kubernetes. This explanation covers the popular package management tool [Helm][] and provides details on using Helm with {{product}}.

## Charts

[Charts][] are the packaging format used by Helm. A chart is a collection of Kubernetes resource manifests related to an application or to a group of applications that can be packaged into versioned archives. Charts utilize templating and template variables called "values" to enable customization of the resources. They can be used to deploy simple applications like a webserver or something complex such as a web application and all of it's requirements.

## Chart repository

[Chart repository][] is a webserver that usually consists of an index and packaged charts. Repositories are the preferred way of distributing charts.

A helm repository can be added to the local client with:

```
helm repo add <repository-name> <repository-url>
```
This command would fetch the index from the repository and store it in a cache directory. This index then would be used for fetching charts to install or to perform an upgrade.

The cached index should be updated to get the latest list of available charts and versions. This is usually done before performing an upgrade. Cached indexes for all repositories can be updated with:

```
helm repo update
```

## Installing and managing charts

A [helm installation][] consists of the templates being rendered with the user supplied values into standard Kubernetes resource manifests.

User supplied values are defined by each chart in the yaml format. Each chart contains a `values.yaml` file that contains defaults, which can be overwritten by users at install time.

`values.yaml` of a chart can be viewed with:
```
helm show values <repository-name>/<chart-name>
```

Helm uses a kubeconfig file just like `kubectl` to apply the generated manifests to the cluster. This means charts can be installed to any Kubernetes cluster, including {{product}}.

```{note}
Retrieve a kubeconfig for your {{product}} cluster in accordance to your installation method. The kubeconfig file can be placed under the default `~/.kube/config` path or `--kubeconfig <path/to/kubeconfig>` flag can be used point Helm to the kubeconfig file.
```

A chart installation can be performed with:

```
helm install <release-name> <repository-name>/<chart-name> --version <version> --values <path/to/values.yaml> --namespace <namespace>
```

```{note}
Helm will install the latest available version on a repository if the `--version` flag is emitted.
```

A single chart can be used to install an application multiple times. Each helm installation creates a **Release**, which are the created Kubernetes resources that are managed by helm. `<release-name>` is used in templates to generate unique Kubernetes resources so the same chart can be used for multiple installations. Helm stores certain metadata on the cluster to maintain the state of releases.

Existing releases under a namespace can be listed with:

```
helm list --namespace <namespace>
```

Process of upgrading a release with a newer version of a chart is similar to the installation process. An [upgrade][] can be performed with:

```
helm upgrade <release-name> <repository-name>/<chart-name> --version <version> --values <path/to/values.yaml> --namespace <namespace>
```

```{note}
The upgrade command can also be used to change the values of an existing release without having to upgrade to a newer version.
```

Each upgrade operation will create a new revision for that release. This makes rollbacks possible in case things go wrong and there is a need to go back to the previous state of a release.

A [rollback][] can be performed with:

```
helm rollback <release-name> <revision> --namespace <namespace>
```

Releases can be totally removed from the cluster with an [uninstallation][].

A release can be uninstalled with:

```
helm uninstall <release-name> --namespace <namespace>
```

<!-- LINKS -->

[Helm]: https://helm.sh/
[Charts]: https://helm.sh/docs/topics/charts/
[Chart repository]: https://helm.sh/docs/topics/chart_repository/
[helm installation]: https://helm.sh/docs/helm/helm_install/
[upgrade]: https://helm.sh/docs/helm/helm_upgrade/
[rollback]: https://helm.sh/docs/helm/helm_rollback/
[uninstallation]: https://helm.sh/docs/helm/helm_uninstall/

0 comments on commit 0975d1b

Please sign in to comment.