DevOps

Deploying a Neo4J single core on managed Kubernetes

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 shows 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.

01
02
03
04
05
06
07
08
09
10
cd /tmp/
git clone https://github.com/sdaschner/neo4j-helm --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.

1
2
3
4
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:

1
2
3
4
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:

1
2
3
4
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!

Published on Java Code Geeks with permission by Sebastian Daschner, partner at our JCG program. See the original article here: Deploying a Neo4J single core on managed Kubernetes (Video)

Opinions expressed by Java Code Geeks contributors are their own.

Sebastian Daschner

Sebastian Daschner is a self-employed Java consultant and trainer. He is the author of the book 'Architecting Modern Java EE Applications'. Sebastian is a Java Champion, Oracle Developer Champion and JavaOne Rockstar.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button