Elasticsearch How to Install OpenSearch on Kubernetes (Using HELM charts)

By Opster Expert Team - Gustavo

Updated: Jun 19, 2024

| 4 min read

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:

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

  1. Kubernetes should already be installed.
  2. The helm chart deploys a 3 nodes cluster, therefore, 8GB RAM is recommended for this deployment.

Installation steps

  1. Install HELM
  2. Add HELM OpenSearch repo
  3. 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

  1. Deploy with custom parameters
  2. Enter into the bash
  3. Update existing HELM charts 
  4. Uninstall OpenSearch deployment

1. Deploy with custom parameters

To deploy with custom parameters you have two alternatives:

  1. Using values helm property
  2. 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.

Additional notes

Elasticsearch and OpenSearch are both powerful search and analytics engines, but Elasticsearch has several key advantages. Elasticsearch boasts a more mature and feature-rich development history, translating to a better user experience, more features, and continuous optimizations. Our testing has consistently shown that Elasticsearch delivers faster performance while using fewer compute resources than OpenSearch. Additionally, Elasticsearch’s comprehensive documentation and active community forums provide invaluable resources for troubleshooting and further optimization. Elastic, the company behind Elasticsearch, offers dedicated support, ensuring enterprise-grade reliability and performance. These factors collectively make Elasticsearch a more versatile, efficient, and dependable choice for organizations requiring sophisticated search and analytics capabilities.