Integrating ArangoDB with Kubernetes for Seamless Deployment

Estimated reading time: 6 minutes

Are you a database architect or DevOps architect tasked with deploying modern databases like ArangoDB on Kubernetes? Kubernetes, with its robust orchestration capabilities, provides a solid foundation for managing containerized workloads, ensuring reliability and adaptability for database deployments.

In this post, we’ll guide you through the process of deploying ArangoDB on Kubernetes, addressing common DevOps challenges like scalability, high availability, and efficient resource utilization. By the end, you'll have a practical understanding of integrating ArangoDB with Kubernetes in a way that’s both robust and future-proof.

Why ArangoDB and Kubernetes?

ArangoDB, as a multi-model database, excels at handling diverse workloads—be it document, graph, or key-value data. When paired with Kubernetes, you gain:

  • Scalability: Automatically adjust resources to meet demand.
  • Resilience: Ensure high availability through self-healing capabilities.
  • Simplicity: Streamline deployment and updates with Infrastructure as Code (IaC).
  • Automation: Minimize manual intervention with Kubernetes' built-in orchestration.

Prerequisites

Before diving into deployment, ensure you have the following ready:

  1. A Kubernetes Cluster: Local (e.g., Minikube) or cloud-based (e.g., AWS EKS, GKE).
  2. kubectl: Installed and configured to interact with your cluster.
  3. Helm: Installed for managing Kubernetes charts.

Step 1: Installing the ArangoDB Kubernetes Operator

The ArangoDB Kubernetes Operator simplifies the deployment and management of ArangoDB clusters. It automates tasks like scaling, failover, and configuration management.

Add the Helm Repository

Start by adding the ArangoDB Helm repository:

bash

helm repo add arangodb https://arangodb.github.io/kube-arangodb
helm repo update

Deploy the Operator

Install the ArangoDB operator in a dedicated namespace:

bash

helm install arango-operator arangodb/kube-arangodb --namespace arangodb --create-namespace

This deploys the operator, which manages the lifecycle of your ArangoDB cluster.

Step 2: Configuring and Deploying an ArangoDB Cluster

Create the Cluster Configuration

Write a configuration file ( e.g., arangodb-cluster.yaml ) to define your cluster. This configuration outlines the desired topology, resource allocation, and environment settings.

Yaml

apiVersion: database.arangodb.com/v1
kind: ArangoDeployment
metadata:
  name: arango-cluster
  namespace: arangodb
spec:
  mode: Cluster
  environment: Production
  image:
    repository: arangodb/arangodb
    tag: latest
  tls:
    mode: None
  authentication:
    jwtSecretName: arango-cluster-jwt
  agents:
    count: 3
    resources:
      requests:
        memory: 1Gi
        cpu: 500m
  dbservers:
    count: 3
    resources:
      requests:
        memory: 2Gi
        cpu: 500m
  coordinators:
    count: 2
    resources:
      requests:
        memory: 1Gi
        cpu: 500m

Apply the Configuration

Deploy your cluster by applying the YAML file:

bash

kubectl apply -f arangodb-cluster.yaml

Verify the deployment status:

bash

kubectl get pods -n arangodb

Step 3: Addressing DevOps Concerns

Scalability

Kubernetes' horizontal scaling ensures that your ArangoDB cluster can handle fluctuating workloads:

bash

kubectl scale deployment arango-cluster-dbserver --replicas=5 -n arangodb

High Availability

With ArangoDB's fault-tolerant architecture and Kubernetes' self-healing, you minimize downtime. For example, Kubernetes automatically restarts failed pods:

bash

kubectl describe pod <pod-name> -n arangodb

Backup and Recovery

Set up a backup strategy using Kubernetes CronJobs:

yaml

apiVersion: batch/v1
kind: CronJob
metadata:
  name: arango-backup
  namespace: arangodb
spec:
  schedule: "0 2 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: arango-backup
            image: arangodb/arangodb
            command: ["arangodump"]
            args:
              - "--output-directory=/backups"
              - "--server.database=mydb"
          restartPolicy: OnFailure

Step 4: Monitoring and Maintenance

Use Kubernetes-native tools like Prometheus and Grafana to monitor your ArangoDB deployment. Enable metrics collection by annotating your pods:

yaml

metadata:
  annotations:
    prometheus.io/scrape: "true"
    prometheus.io/port: "8529"

Summary

Integrating ArangoDB with Kubernetes offers an elegant solution for managing complex database workloads. By leveraging Kubernetes' orchestration capabilities, you can ensure your database is scalable, resilient, and easy to manage. Whether you're a seasoned DevOps professional or new to container orchestration, this setup will provide a reliable foundation for your ArangoDB deployment.

Happy deploying!

More info...

Running ArangoDB on Mac with Docker

When I work with ArangoDB on my Mac, I usually install ArangoDB via homebrew and do tests on the latest new developments based on the devel-branch, compiling ArangoDB right from source.

To test a feature in a special version I use docker images that need a virtual machine on MacOS. I struggled with Boot2Docker several times and recently tried Docker Machine – with the Web UI Kitematic – currently in beta. Read more

More info...

Using Multiple Indexes per Collection in ArangoDB

The query optimizer in ArangoDB 2.8 has been improved in terms of how it can make use of indexes. In previous versions of ArangoDB, the query optimizer could use only one index per collection used in an AQL query. When using a logical OR in a FILTER condition, the optimizer did not use any index for the collection in order to ensure the result is still correct.

This is much better in 2.8. Now the query optimizer can use multiple indexes on the same collection for FILTER conditions that are combined with a logical OR. Read more

More info...

Foxx Module Resolution Changes in ArangoDB 2.8

The implementation of the JavaScript require function will be adjusted to improve compatibility with npm modules. The current implementation in 2.7 and earlier versions of ArangoDB strictly adheres to the CommonJS module standard, which deviates from the behaviour implemented in Node and browser bundlers.

Module paths will now be resolved in the following ways: Read more

More info...

Running V8 Isolates in Multi-Threaded ArangoDB

ArangoDB allows running user-defined JavaScript code in the database. This can be used for more complex, stored procedures-like database operations. Additionally, ArangoDB’s Foxx framework can be used to make any database functionality available via an HTTP REST API. It’s easy to build data-centric microservices with it, using the scripting functionality for tasks like access control, data validation, sanitation etc.

We often get asked how the scripting functionality is implemented under the hood. Additionally, several people have asked how ArangoDB’s JavaScript functionality relates to node.js.

This post tries to explain that in detail.

(more…)

More info...

Dockerizing a Bloom-Based Nonces Service in 10 Minutes

In this article I want to explain how to setup a nonce-microservice using docker.

Nonce are one-time tokens that are used to ensure that an action can only be taken once. In a project, we needed to ensure that a pay button is only pressed once. Note that nonces are not used to sign requests or identify a user. This is a separate mechanism.

ArangoDB contains a nonce implementation which is a variation of Bloom-filters. It allows to store nearly unlimited nonces within a limited amount of memory. Nonce are allowed to age, that is after an hour they might expire. If there is sufficient interest, I will explain the algorithm implemented in a separate blog post.

(more…)

More info...

Create an ArangoDB cluster on Microsoft Azure

During the last weeks we’ve released our new deployment tool for cloud computing platforms with how-to’s for Google Compute Engine, Digital Ocean and Amazon Web Services support.

Today we show how to deploy an ArangoDB cluster on Azure with a single command.

Azure

To easy-deploy an ArangoDB cluster on Azure you just need to install the official azure-cli, download a single bash script and watch the tool take care of the rest for you. Your azure account needs permission for creating instances, adding ssh-keypairs and managing virtual networks.

wget https://raw.githubusercontent.com/ArangoDB/deployment/publish/Azure_ArangoDB_Cluster.sh
chmod 755 Azure_ArangoDB_Cluster.sh

(more…)

More info...

ArangoDB 2.6 API Changes: Updates & Enhancements

ArangoDB 2.6 comes with new and changed APIs as well as changed behavior regarding document keys and several graph functions.

If you use Travis-CI for your tests you can download the Travis-CI ArangoDB build here: Travis-CI/ArangoDB-2.6.0-alpha2.tar.gz

The changes so far:

APIs added

  • added batch document removal and lookup APIs:

    These APIs can be used to perform multi-document lookup and removal operations efficiently. The arguments to these APIs are the name of the collection plus the array of document keys to fetch or remove.

    The endpoints for these APIs are as follows:

    PUT /_api/simple/lookup-by-keys
    PUT /_api/simple/remove-by-keys
    

    Example call to fetch documents:

    curl -X PUT \ http://127.0.0.1:8529/\_db/\_system/_api/simple/lookup-by-keys \ --data '{"collection":"myCollection","keys":["test1","test3"]}'
    

    The documents will be returned in an attribute documents of the HTTP response. documents is an array containing all documents found. Only those documents that were actually found will be returned. Documents that were searched but do not exist will not be returned and do not trigger any errors. (more…)

More info...

AQL Explain Web Interface: ArangoDB Query Optimization

For developers that use the ArangoDB shell arangosh the explain() command and its compact output format is a great resource to check AQL queries. Explain prints the original query, the generated query execution plan, the applied optimizer rules plus the list of indexes that will be used. Jan showed in a blog post how this can look like.

While preparing ArangoDB 2.6 we found some time to add this feature to the Web UI. So now you can check you AQL queries right in the Web-Interface as well. (more…)

More info...

Improved System User Authentication: ArangoDB Security Upgrade

ArangoDB can easily be configured to require HTTP authentication for access to the web admin frontend or the REST API. But while Basic Auth works fine for APIs, the user experience in the web admin frontend was decidedly sub-par: browsers would often persist the authentication credentials indefinitely, logging out was made difficult or impossible and switching users was hit-or-miss.

The upcoming ArangoDB 2.6 release introduces cookie-based authentication for the web admin frontend, allowing you to side-step the issue altogether by using the built-in session manager instead of the low-level HTTP API authentication. (more…)

More info...

Get the latest tutorials,
blog posts and news: