sebastiandaschner blog

Deploying a Neo4J single core on managed Kubernetes (Video)

#kubernetes #neo4j friday, june 05, 2020

Besides running a database cluster, it might already be sufficient for your project to deploy a single instance. In the following video I’ll explain how to deploy a single core Neo4J instance using Helm to a managed Kubernetes cluster.

I’ll be using a forked and modified version of the official Helm chart, which you can find in this GitHub repository branch.

The example Helm chart got rid of the discovery mechanisms which are not required and some other Kubernetes resources, so the resulting deployment is simpler compared to the cluster version I showed previously.


Try it yourself

Similar to the cluster version, you can try this out yourself by deploying on a managed Kubernetes environment. If you need access to a Kubernetes cluster, you can follow this guide to get started on IKS. You will need Helm in version v3.x.

cd /tmp/
git clone --branch single-instance
cd neo4j-helm/

helm template graphdb \
  --set acceptLicenseAgreement=yes \
  --set neo4jPassword=mySecretPassword . \
  > /tmp/neo4j.yaml

kubectl apply -f /tmp/neo4j.yaml

With that, Kubernetes will provision the resources including the volume claim and your cloud provider will create the persistent volume.

kubectl get pvc

NAME                           STATUS   [...]  STORAGECLASS     AGE
datadir-graphdb-neo4j-core-0   Pending         ibmc-file-gold   13s

After a while your persistent volumes will be provisioned:

kubectl get pvc

NAME                           STATUS   VOLUME               STORAGECLASS     AGE
datadir-graphdb-neo4j-core-0   Bound    pvc-8c0ae307-[...]   ibmc-file-gold   2m24s

Once that is the case, the single Neo4J pod provided by the stateful set should be up-and-running:

kubectl get pods

NAME                               READY   STATUS    RESTARTS   AGE
graphdb-neo4j-core-0               1/1     Running   0          4m13s

Testing the connection, and running the example coffee beans application is similar to the cluster version. Here, we only have the core-0 instance available, which is also accessed from the graphdb-neo4j service, or directly via port-forward for debugging purposed, as shown previously.

Happy Neo4J graph databasing!


Found the post useful? Subscribe to my newsletter for more free content, tips and tricks on IT & Java: