Overview
In this article, we will explain all the steps needed to spin up an OpenSearch cluster on Kubernetes using HELM charts. For the sake of these instructions, the assumption is that readers are already familiar with raising and managing Kubernetes clusters.
If you aren’t familiar with this, here are some useful links:
- Kubernetes setup: Getting started | Kubernetes
- HELM setup: Helm | Installing Helm
- Official docs: Helm – OpenSearch documentation
What are Helm charts?
Helm is the best way to find, share, and use software built for Kubernetes. In short, it makes the task of managing and maintaining kubernetes deployments smooth and simple.
A chart is a collection of files that describe a related set of Kubernetes resources, from something as simple as a single pod to something as complex as full system architecture.
You can explore all the available charts in the Artifacts Hub.
Prerequisites for this installation method
- Kubernetes should already be installed.
- The helm chart deploys a 3 nodes cluster, therefore, 8GB RAM is recommended for this deployment.
Installation steps
- Install HELM
- Add HELM OpenSearch repo
- Deploy
1. Install HELM
Depending on your system you can use the common package managers (homebrew, chocolatey, apt, snap, etc ..), execute a binary file, from an installation script, or build from the source. You can visit Helm | Installing Helm for more information.
Homebrew:
brew install helm
Chocolatey:
choco install kubernetes-helm
APT:
curl https://baltocdn.com/helm/signing.asc | sudo apt-key add - sudo apt-get install apt-transport-https --yes echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list sudo apt-get update sudo apt-get install helm
2. Add HELM Opensearch repo
$ helm repo add OpenSearch https://opensearch-project.github.io/helm-charts/
$ helm repo update
You can confirm the repo was added by running:
helm search repo opensearch
The output should look like this:
3. Deploy
To deploy, run:
helm install helm-opensearch opensearch/opensearch
The output should look like this:
Watch the cluster members:
kubectl get pods --namespace=default -l app.kubernetes.io/component=opensearch-cluster-master -w
Usage instructions
- Deploy with custom parameters
- Enter into the bash
- Update existing HELM charts
- Uninstall OpenSearch deployment
1. Deploy with custom parameters
To deploy with custom parameters you have two alternatives:
- Using values helm property
- Building the helm charts from the OpenSearch tarball file.
Using values helm property
To deploy with custom parameters using values help property, run the following helm command:
$ helm upgrade --wait --timeout=$(TIMEOUT) --namespace $(NAMESPACE) --install $(PREFIX)-master opensearch/opensearch --values master.yaml --version $(VERSION)
The master.yaml file referenced in the command can be taken from this link: https://github.com/opensearch-project/helm-charts/blob/main/charts/opensearch/values.yaml
Building the helm charts from the OpenSearch tarball file
Clone the helm-charts repo:
git clone https://github.com/opensearch-project/helm-charts
Change to the OpenSearch folder:
cd charts/opensearch
Package Helm chart (note the dot at the end):
helm package .
Deploy generated package, pass the custom values using a YAML file:
helm install --values=customvalues.yaml opensearch-1.2.0.tgz
2. Enter into the bash
Get the pods:
kubectl get pods
Access to the shell using the pod name:
kubectl exec -it opensearch-cluster-master-0 -- /bin/bash
3. Update existing HELM charts:
If you already installed the chart you can update to the last version:
helm repo update
4. Uninstall OpenSearch deployment
Next, you need to uninstall the OpenSearch deployment. Start by finding the deployment name:.
helm list
You can then delete using that name:
helm delete opensearch-1-1629223146
Summary
Helm is a Kubernetes package manager that can help you manage your OpenSearch installations, making your deployments reproducible and version managed.
With Helm you can quickly deploy a standard configured cluster, but also set your own parameters for more complex scenarios.