The Tarantool Operator provides automation that simplifies the administration of Tarantool Cartridge-based cluster on Kubernetes.
The Operator introduces new API version tarantool.io/v1alpha1
and installs
custom resources for objects of three custom types: Cluster, Role, and
ReplicasetTemplate.
- Resources
- Resource ownership
- Deploying the Tarantool operator on minikube
- Example: key-value storage
Cluster represents a single Tarantool Cartridge cluster.
Role represents a Tarantool Cartridge user role.
ReplicasetTemplate is a template for StatefulSets created as members of Role.
Resources managed by the Operator being deployed have the following resource ownership hierarchy:
Resource ownership directly affects how Kubernetes garbage collector works. If you execute a delete command on a parent resource, then all its dependants will be removed.
-
Install the required deployment utilities:
Pick one of these to run a local kubernetes cluster
To install and configure a local minikube installation:
-
Create a
minikube
cluster:minikube start --memory=4096
You will need 4Gb of RAM allocated to the
minikube
cluster to run examples.Ensure
minikube
is up and running:minikube status
In case of success you will see this output:
host: Running kubelet: Running apiserver: Running
-
Enable minikube Ingress add-on:
minikube addons enable ingress
-
-
Install the operator
helm install tarantool-operator ci/helm-chart --namespace tarantool --create-namespace
Ensure the operator is up:
watch kubectl get pods -n tarantool
Wait for
tarantool-operator-xxxxxx-xx
Pod's status to becomeRunning
.
examples/kv
contains a Tarantool-based distributed key-value storage.
Data are accessed via HTTP REST API.
We assume that commands are executed from the repository root and Tarantool Operator is up and running.
-
Create a cluster:
helm install examples-kv-cluster examples/kv/helm-chart --namespace tarantool
Wait until all the cluster Pods are up (status becomes
Running
):watch kubectl -n tarantool get pods
-
Ensure cluster became operational:
kubectl -n tarantool describe clusters.tarantool.io examples-kv-cluster
wait until Status.State is Ready:
... Status: State: Ready ...
-
Access the cluster web UI:
-
If using minikube:
- Get
minikube
vm IP-address:
minikube ip
- Open http://MINIKUBE_IP in your browser. Replace MINIKUBE_IP with the IP-address reported by the previous command.
NOTE: Due to a recent bug in Ingress, web UI may be inaccessible. If needed, you can try this workaround.
- Get
-
If using kubernetes in docker-desktop
Run: (MINIKUBE_IP will be localhost:8081 in this case)
kc port-forward -n tarantool routers-0-0 8081:8081
-
-
Access the key-value API:
-
Store some value:
curl -XPOST http://MINIKUBE_IP/kv -d '{"key":"key_1", "value": "value_1"}'
In case of success you will see this output:
{"info":"Successfully created"}
-
Access stored values:
curl http://MINIKUBE_IP/kv_dump
In case of success you will see this output:
{"store":[{"key":"key_1","value":"value_1"}]}
-
-
Increase the number of replica sets in Storages Role:
in the examples-kv helm chart, edit the
examples/kv/helm-chart/values.yaml
file to be- RoleName: storage ReplicaCount: 1 ReplicaSetCount: 2
Then run:
helm upgrade examples-kv-cluster examples/kv/helm-chart --namespace tarantool
This will add another storage role replica set to the existing cluster. View the new cluster topology via the cluster web UI.
-
Increase the number of replicas across all Storages Role replica sets:
in the examples-kv helm chart, edit the
examples/kv/helm-chart/values.yaml
file to be- RoleName: storage ReplicaCount: 2 ReplicaSetCount: 2
Then run:
helm upgrade examples-kv-cluster examples/kv/helm-chart --namespace tarantool
This will add one more replica to each Storages Role replica set. View the new cluster topology via the cluster web UI.
make crds
make docker
# In the examples/kv directory
make build
make start
./bootstrap.sh
make test