From 0975d1bd1d13dcbd8301cc068e05cece7f9bca23 Mon Sep 17 00:00:00 2001 From: Berkay Tekin Oz Date: Wed, 15 Jan 2025 11:35:40 +0000 Subject: [PATCH] Add package management with helm explanation --- docs/src/snap/explanation/index.md | 1 + .../snap/explanation/package-management.md | 95 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 docs/src/snap/explanation/package-management.md diff --git a/docs/src/snap/explanation/index.md b/docs/src/snap/explanation/index.md index 678419952..c5c79f54b 100644 --- a/docs/src/snap/explanation/index.md +++ b/docs/src/snap/explanation/index.md @@ -21,6 +21,7 @@ epa high-availability security cis +package-management ``` --- diff --git a/docs/src/snap/explanation/package-management.md b/docs/src/snap/explanation/package-management.md new file mode 100644 index 000000000..b37e06c7d --- /dev/null +++ b/docs/src/snap/explanation/package-management.md @@ -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 +``` +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 / +``` + +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 ` flag can be used point Helm to the kubeconfig file. +``` + +A chart installation can be performed with: + +``` +helm install / --version --values --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. `` 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 +``` + +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 / --version --values --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 --namespace +``` + +Releases can be totally removed from the cluster with an [uninstallation][]. + +A release can be uninstalled with: + +``` +helm uninstall --namespace +``` + + + +[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/