1) Wait until all pods are moved to running state:

kubectl --namespace {{ .Release.Namespace }} get po

2) Forward worker port to your local machine:

export WORKER_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "manticoresearch.name" . }},app.kubernetes.io/instance={{ .Release.Name }},label=manticore-worker" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace {{ .Release.Namespace }} port-forward $WORKER_NAME 7306:{{ .Values.worker.service.ql.port }}

3) Connect to the worker:

mysql -h0 -P7306

4) Create your first table:

CREATE TABLE idx(title text);

5) Add table to cluster:

ALTER CLUSTER {{ .Values.worker.clusterName }} ADD idx;

6) Add some data to your table:

INSERT INTO {{ .Values.worker.clusterName }}:idx (title) VALUES ('dog is brown'), ('mouse is small');

7) Forward worker port to your local machine:

export BALANCER_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "manticoresearch.name" . }},app.kubernetes.io/instance={{ .Release.Name }},name={{ include "manticoresearch.fullname" . }}-balancer" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace {{ .Release.Namespace }} port-forward $BALANCER_NAME 6306:{{ .Values.balancer.service.ql.port }}

8) Search through the balancer:

mysql -h0 -P6306 -e "SELECT * FROM idx WHERE match('dog')"

9) Scale the cluster:

kubectl scale statefulsets manticore-manticoresearch-worker -n {{ .Release.Namespace }} --replicas=5
