Launching Neo4j on Google’s Kubernetes Marketplace

David Allen
Jul 31, 2018 · 4 min read

At the recent Cloud Next ’18 conference, Google announced the availability of Kubernetes applications in GCP marketplace. The gist of this is that now applications can be installed into a Kubernetes cluster from the marketplace, without writing any YAML.

Neo4j was one of the launch partners for this, and so I wanted to show a bit of how this works in practice, and why it’s cool. Today we’ll go from “I don’t have a Kubernetes cluster” to running Cypher in Neo4j inside of a Kubernetes cluster in about 10 minutes or so. We will be using the Neo4j Marketplace Entry.

Image for post
Image for post

Create a GKE Cluster

Let’s start by creating a Google Kubernetes Engine (GKE) cluster. GKE is Google’s hosted Kubernetes service. Basically regular Kubernetes with a few nice add ons and a great management shell that works with the CLI.

Image for post
Image for post
Achievement unlocked: shiny new kubernetes cluster

Now that we’ve got that in place, we just look up Neo4j in the GCP marketplace, making sure to use the “Kubernetes Apps” filter. You can jump straight to the right spot with this link.

Image for post
Image for post

Deploying Neo4j

Clicking this tile leads to the product overview page, with a big “Configure” button on it, which we’re going to click. Also on that product overview page is a link to the Neo4j on GKE User Guide, which is hosted on Github along with all of the helm charts and templates needed to recreate what this product is doing, or customize it, depending on what you need.

Configuring our solution, setting up a clustered database is pretty easy, we just need to choose various settings. Most important is “server replicas” which controls how many core nodes are in your neo4j cluster, and read replicas. I’ll keep the defaults, but this is worth considering for capacity in your cluster. You’ll be starting a stateful set with at least server replicas + read replicas.

Because Neo4j prefers SSDs, as of this writing there is one manual step to do — click the “Cloud Shell” button near the bottom to set up solid state disk ability. If you’re familiar with Kubernetes, what that’s doing is creating a new storage class and applying the config to your cluster. The command is pre-populated, you just have to hit enter.

Image for post
Image for post

Alright, now we’re ready to roll, just click “Deploy” and immediately containers start getting scheduled onto your cluster. Google will take you to the “Applications” tab under your GKE cluster window to show you the status as things move along. Of course you can dive into any of these workloads and inspect individual container logs, status, and so on.

Image for post
Image for post
The GKE workloads menu shows my core pods being deployed

After your cluster has finished deployed, this is what the happy state looks like:

Image for post
Image for post
Ready to roll

Wait, What’s My Password?

When neo4j gets deployed, a strong password is chosen for you and assigned, then stored in a kubernetes secret. You can get that directly through the GKE UI by choosing Configuration -> my-graph-neo4j-secrets and then looking at the neo4j-password field, or you can get it from kubectl like so in your cloud shell:

$ kubectl get secrets my-graph-neo4j-secrets -o yaml | grep neo4j-password: | sed 's/.*neo4j-password: *//' | base64 --decode
3lg81oVvGY

(Remember to replace “my-graph” with the name of your deploy)

You can now connect to the internal DNS address:

$APP_INSTANCE_NAME-neo4j.$NAMESPACE.svc.cluster.local

Where $APP_INSTANCE_NAME is the name of your deploy, and $NAMESPACE is the kubernetes namespace where it is deployed.

Creating a simple Cypher Shell

Launching a shell requires scheduling the solution container into your cluster, and running cypher-shell as its entrypoint, like so:

$ kubectl run -it --rm cypher-shell \
--image=gcr.io/cloud-marketplace/neo4j-public/causal-cluster-k8s:3.4 \
--restart=Never \
--namespace=default \
--command -- ./bin/cypher-shell -u neo4j \
-p "$NEO4J_PASSWORD" \
-a $APP_INSTANCE_NAME-neo4j.default.svc.cluster.local

And you’re in business.

Further Information

Make sure to check out the Neo4j on GKE User Guide on github for full details on how to use your instance, how to set up SSH forwarding to use Neo4j Browser, all of the templates you need to customize your own kubernetes/neo4j solution, and more.

If you have any other questions, please follow up with us on the Neo4j Community Site!

Happy graph hacking!

Google Cloud - Community

Google Cloud community articles and blogs

David Allen

Written by

Architect at Neo4j

Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

David Allen

Written by

Architect at Neo4j

Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store