Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
253 lines (170 sloc) 6.04 KB

Tarantool Kubernetes operator

The Tarantool Operator provides automation that simplifies the administration of Tarantool Cartridge-based clusters on Kubernetes.

The Operator introduces new API version and installs custom resources for objects of three custom types: Cluster, Role, and ReplicasetTemplate.

Table of contents


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.

Resource ownership

Resources managed by the Operator being deployed have the following resource ownership hierarchy:

Resource ownership

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.

Deploying the Tarantool operator on minikube

  1. Install the required software:

  2. 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
  3. Enable Ingress add-on:

    minikube addons enable ingress
  4. Create operator resources:

    kubectl create -f deploy/service_account.yaml
    kubectl create -f deploy/role.yaml
    kubectl create -f deploy/role_binding.yaml
  5. Create Tarantool Operator CRD's (Custom Resource Definitions):

    kubectl create -f deploy/crds/tarantool_v1alpha1_cluster_crd.yaml
    kubectl create -f deploy/crds/tarantool_v1alpha1_role_crd.yaml
    kubectl create -f deploy/crds/tarantool_v1alpha1_replicasettemplate_crd.yaml
  6. Start the operator:

    kubectl create -f deploy/operator.yaml

    Ensure the operator is up:

    kubectl get pods --watch

    Wait for tarantool-operator-xxxxxx-xx Pod's status to become Running.

Example: key-value storage

examples/kv contains a Tarantool-based distributed key-value storage. Data are accessed via HTTP REST API.

Application topology

App topology

Running the application

We assume that commands are executed from the repository root and Tarantool Operator is up and running.

  1. Create a cluster:

    kubectl create -f examples/kv/deployment.yaml

    Wait until all the cluster Pods are up (status becomes Running):

    kubectl get pods --watch
  2. Ensure cluster became operational:

    kubectl describe examples-kv-cluster

    wait until Status.State is Ready:

      State:  Ready
  3. Access the cluster web UI:

    1. Get minikube vm IP-address:

      minikube ip
    2. Open http://MINIKUBE_IP in your browser. Replace MINIKUBE_IP with the IP-address reported by the previous command.

      Web UI

NOTE: Due to a recent bug in Ingress, web UI may be inaccessible. If needed, you can try this workaround.

  1. Access the key-value API:

    1. 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"}
    2. Access stored values:

      curl http://MINIKUBE_IP/kv_dump

      In case of success you will see this output:


Scaling the application

  1. Increase the number of replica sets in Storages Role:

    kubectl edit storage

    This will open the resource in a text editor. Change spec.numReplicasets field value to 3:

      numReplicasets: 3

    Save your changes and exit the editor.

    This will add new replica sets to the existing cluster.

    View the new cluster topology via the cluster web UI.

  2. Increase the number of replicas across all Storages Role replica sets:

    kubectl edit storage-template

    This will open the resource in a text editor. Change spec.replicas field value to 3:

      replicas: 3

    Save your changes and exit the editor.

    This will add one more replica to each Storages Role replica set.

    View the new cluster topology via the cluster web UI.

NOTE: When kubectl 1.16 is out, you will be able to scale the application with a single kubectl scale command, for example kubectl scale storage --replicas=3. With younger versions of kubectl this is impossible due to this bug.

Running tests

make build
make start
make test
You can’t perform that action at this time.