Start ArangoDB on Kubernetes in 5 minutes
The servers need to run in , you need Secrets
for authentication,TLS certificates and Services
to enable communication with the database.
Use kube-arangodb
, the ArangoDB Kubernetes Operator to greatly simplifythis process.
In this guide, we will explain what the ArangoDB Kubernetes Operator is,how to install it and how use it to deploy your first ArangoDB databasein a Kubernetes cluster.
kube-arangodb
is a set of two operators that you deploy in your Kubernetescluster to (1) manage deployments of the ArangoDB database and (2)provide PersistentVolumes
on local storage of your nodes for optimalstorage performance.
Note that the operator that provides PersistentVolumes
is not needed torun ArangoDB deployments. You can also use PersistentVolumes
providedby other controllers.
In this guide we will focus on the ArangoDeployment
operator.
Installing kube-arangodb
To install kube-arangodb
in your Kubernetes cluster, make sureyou have access to this cluster and the rights to deploy resourcesat cluster level.
For now, any recent Kubernetes cluster will do (e.g. minikube
).
Then run (replace <version>
with the version of the operator that you want to install):
ArangoDeployment
is the resource used to deploy ArangoDB database.ArangoLocalStorage
is the resource used to provisionPersistentVolumes
on local storage.The second command installs aDeployment
that runs the operator that controlsArangoDeployment
resources.
The optional third command installs a that runs the operator thatprovides PersistentVolumes
on local disks of the cluster nodes.Use this when running on bare-metal or if there is no provisioner for faststorage in your Kubernetes cluster.
The first database we are going to deploy is a single server database.
Create a file called single-server.yaml
with the following content.
kind: "ArangoDeployment"
metadata:
name: "single-server"
spec:
mode: Single
Now insert this resource in your Kubernetes cluster using:
kubectl apply -f single-server.yaml
The ArangoDeployment
operator in kube-arangodb
will now inspect theresource you just deployed and start the process to run a single server database.
To inspect the current status of your deployment, run:
To inspect the pods created for this deployment, run:
kubectl get pods --selector=arango_deployment=single-server
The result will look similar to this:
NAME READY STATUS RESTARTS AGE
Once the pod reports that it is has a Running
status and is ready,your database s available.
Connecting to your database
Access to the database from outside the Kubernetes cluster is providedusing an external-access service.By default this service is of type LoadBalancer
. If this type of serviceis not supported by your Kubernetes cluster, it will be replaced bya service of type NodePort
after a minute.
To see the type of service that has been created, run:
When the service is of the type, use the IP addresslisted in the EXTERNAL-IP
column with port 8529.When the service is of the NodePort
type, use the IP addressof any of the nodes of the cluster, combine with the high (>30000) port listed in the PORT(S)
column.
Now you can connect your browser to https://<ip>:<port>/
.
Your browser will show a warning about an unknown certificate.Accept the certificate for now.
Then login using username root
and an empty password.
If you want to delete your single server ArangoDB database, just run:
kubectl delete ArangoDeployment single-server
The deployment of a full blown cluster is very similar to deployinga single server database. The difference is in the mode
field ofthe ArangoDeployment
specification.
Create a file called cluster.yaml
with the following content.
apiVersion: "database.arangodb.com/v1alpha"
kind: "ArangoDeployment"
metadata:
name: "cluster"
spec:
mode: Cluster
The same commands used in the single server deployment can be usedto inspect your cluster. Just use the correct deployment name (cluster
instead of single-server
).