Coder Social home page Coder Social logo

tarantool-operator's Introduction

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 tarantool.io/v1alpha1 and installs custom resources for objects of three custom types: Cluster, Role, and ReplicasetTemplate.

Table of contents

Resources

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 clusters.tarantool.io examples-kv-cluster

    wait until Status.State is Ready:

    ...
    Status:
      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:

      {"store":[{"key":"key_1","value":"value_1"}]}

Scaling the application

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

    kubectl edit roles.tarantool.io storage

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

    spec:
      replicas: 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 replicasettemplates.tarantool.io storage-template

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

    spec:
      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 roles.tarantool.io storage --replicas=3. With younger versions of kubectl this is impossible due to this bug.

Running tests

make build
make start
./bootstrap.sh
make test

tarantool-operator's People

Contributors

vasiliy-t avatar lenkis avatar opomuc avatar artur-barsegyan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.