home shape

Deploying ArangoDB on Kubernetes and customizing settings

Estimated reading time: 6 minutes

Introduction

   Deploying an ArangoDB cluster on Kubernetes is a straightforward process thanks to the ArangoDB Operator, a powerful tool that simplifies the deployment, management, and scaling of ArangoDB clusters in a Kubernetes environment. 

  In this post, we’ll walk you through the steps to quickly deploy an ArangoDB cluster on Kubernetes, covering what the main components are and how to customize settings to ensure the cluster runs optimally for your needs.

  The deployment steps will be followed considering that there is already a kubernetes set up and the user executing the commands has administrator privileges.

For this demonstration we will be using:

  • Arangodb 3.12.4 image
  • Kubernetes Server version 1.27.16
  • ArangoDB Operator  1.2.46

Executing the installation steps  

  An ArangoDB Cluster has three main components which are the Agents, Coordinators and DB Servers, but in a Kubernetes environment these components are created as pods along with the operator pods. Therefore, the installation steps will be based on configuring yaml files and creating pods using the "kubectl" utility, as described below: 

Installing the operator

export URLPREFIX=https://raw.githubusercontent.com/arangodb/kube-arangodb/1.2.46/manifests
kubectl apply -f $URLPREFIX/arango-crd.yaml

code 1

kubectl apply -f $URLPREFIX/arango-deployment.yaml

code 2
To use ArangoLocalStorage resources to provision Persistent Volumes on local storage, also run:

kubectl apply -f $URLPREFIX/arango-storage.yaml

kubectl apply -f $URLPREFIX/arango-storage.yaml
kubectl apply -f $URLPREFIX/arango-storage.yaml

code 3

Confirm that the pods were created successfully

kubectl get pods

kubectl apply -f $URLPREFIX/arango-storage.yaml
kubectl apply -f $URLPREFIX/arango-storage.yaml

code 4

Storage Configuration

Create the file storage.yaml with the content below

code 5

kubectl apply -f storage.yaml

kubectl apply -f $URLPREFIX/arango-storage.yaml
kubectl apply -f $URLPREFIX/arango-storage.yaml

code 5

Confirm that the pods were created successfully

kubectl get pods

kubectl apply -f $URLPREFIX/arango-storage.yaml
kubectl apply -f $URLPREFIX/arango-storage.yaml

code 5

ArangoDB deployment creation

  After deploying the latest ArangoDB Kubernetes operator and configuring storage resources, we will create the ArangoDB database deployment itself by creating an ArangoDeployment custom resource and deploying it into our Kubernetes.

We will create a basic yaml file cluster-deployment.yaml with the content below

code 5

kubectl apply -f cluster-deployment.yaml

kubectl apply -f $URLPREFIX/arango-storage.yaml
kubectl apply -f $URLPREFIX/arango-storage.yaml

code 5
 
Wait for few minutes and we will find all the components pods running (3 for each of them) when  confirming that the pods were created successfully. We have a working ArangoDB cluster running on kubernetes and ready to be used.

kubectl get pods

kubectl apply -f $URLPREFIX/arango-storage.yaml
kubectl apply -f $URLPREFIX/arango-storage.yaml

code 5

Customizing settings

   As we showed in the previous steps, we used a basic yaml file to create the ArangoDB database deployment, it means that most settings will be the default, this is fine and may work for multiple users, but we may need to customize some settings regarding how resources are allocated or even some database parameters to support specific needs that are particular to each environment, user or application using Arangodb.

   In our “cluster-deployment.yaml” we did not specify any resource limit for any of the components (agents, coordinators, DBServers), that means for example that the coordinators could use the whole memory available on the Kubernetes machine (in our case 32GB), which is something that we don’t want. The coordinator log section below highlights the statement above, we see a message that confirms the whole machine memory is available for the coordinators utilization.

code 5

  In order to limit the amount of resources available for the coordinators, we modify the Arango deployment using the command “kubectl edit” to include the lines below right after the coordinators section start in the yaml configuration.

kubectl edit arango/deployment

kubectl apply -f $URLPREFIX/arango-storage.yaml
kubectl apply -f $URLPREFIX/arango-storage.yaml

code 5

Each of the coordinators pods will be terminated and then started as we can see below

code 5
code 5

After having all the coordinators restarted, we look at the coordinator log again and we can see the amount of memory available for the coordinators is now only 512MB, as we specified in the deployment yaml file.  The same approach can be followed for the Agents and DBServers.

code 5

  Now let’s change an ArangoDB Server option, the idea is quite similar to the resource limit change we have done previously, we will need to edit the deployment yaml using the command “kubectl edit” and include the option we want to modify under the corresponding section.

  For our example, we are going to enable the experimental vector index feature , available as of 3.12.4 version, by setting “--experimental-vector-index” to true, this needs to be placed under both the coordinators and dbservers sections, by including the reserved word “args” as shown below:

code 5

After saving the changes, the coordinators and dbservers pods will restart again, then we can connect to any of the coordinators to confirm that “--experimental-vector-index” is really set to true.

code 5

code 5

There we go! The experimental vector index feature was successfully enabled, by the way, you can find more information about this feature on this  blog post.

Conclusion

  Deploying an ArangoDB cluster on Kubernetes is a quick and efficient process, offering significant flexibility to meet the specific requirements of multiple applications. The ability to adjust resources and fine-tune ArangoDB server options ensures that your setup can be tailored to fit various business needs, performance goals, and infrastructure capabilities. Customization is relevant for maintaining optimal performance and scalability, allowing your system to evolve in line with changing demands. Associating Kubernetes and ArangoDB, you're not only simplifying deployment, but also gaining a powerful solution that adapts seamlessly to your needs.

Hugues Tomas

Leave a Comment





Get the latest tutorials, blog posts and news: