There are two ways to get started with the operator:
If you use Helm to manage your Kubernetes cluster, you can use the OpenSearch Kubernetes Operator’s Cloud Native Computing Foundation (CNCF) project stored in Artifact Hub, a web-based application for finding, installing, and publishing CNCF packages.
To begin, log in to your Kubernetes cluster and add the Helm repository (repo) from Artifact Hub.
Make sure that the repo is included in your Kubernetes cluster.
Both the opensearch
and opensearch-operator
repos appear in the list of repos.
Install the manager that operates all of the OpenSearch Kubernetes Operator’s actions.
helm install opensearch-operator opensearch-operator/opensearch-operator
Use a local installation
If you want to create a new Kubernetes cluster on your existing machine, use a local installation.
If this is your first time running Kubernetes and you intend to run through these instructions on your laptop, make sure that you have the following installed:
Before running through the installation steps, make sure that you have a Kubernetes environment running locally. When using minikube, open a new terminal window and enter minikube start
. Kubernetes will now use a containerized minikube cluster with a namespace called default
.
Then install the OpenSearch Kubernetes Operator using the following steps:
- In your preferred directory, clone the . Navigate into repo’s directory using
cd
. - Go to the
opensearch-operator
folder. - Enter
make build manifests
.
- Enter
make install
to create the CustomResourceDefinition that runs in your Kubernetes cluster. - Start the OpenSearch Kubernetes Operator. Enter
make run
.
To ensure that Kubernetes recognizes the OpenSearch Kubernetes Operator as a namespace, enter k get ns | grep opensearch
. Both opensearch
and opensearch-operator-system
should appear as Active
.
With the operator active, use k get pod -n opensearch-operator-system
to make sure that the operator’s pods are running.
opensearch-operator-controller-manager-<pod-id> 2/2 Running 0 25m
From your cloned OpenSearch Kubernetes Operator repo, navigate to the opensearch-operator/examples
directory. There you’ll find the opensearch-cluster.yaml
file, which can be customized to the needs of your cluster, including the clusterName
that acts as the namespace in which your new OpenSearch cluster will reside.
With your cluster configured, run the kubectl apply
command.
kubectl apply -f opensearch-cluster.yaml
The operator creates several pods, including a bootstrap pod, three OpenSearch cluster pods, and one Dashboards pod. To connect to your cluster, use the port-forward
command.
Open http://localhost:5601 in your preferred browser and log in with the default demo credentials admin / admin
. You can also run curl commands against the OpenSearch REST API by forwarding to port 9200.
kubectl port-forward svc/my-cluster 9200
In order to delete the OpenSearch cluster, delete the cluster resources. The following command deletes the cluster namespace and all its resources.
To learn more about how to customize your Kubernetes OpenSearch cluster, including data persistence, authentication methods, and scaling, see the OpenSearch Kubernetes Operator User Guide.