# Launching Neo4j on Google Kubernetes Marketplace

**URL:** <https://community.neo4j.com/t/launching-neo4j-on-google-kubernetes-marketplace/2376>\
**Category:** Community Content & Blogs\
**Created:** [October 11, 2018, 12:23pm UTC](https://community.neo4j.com/t/launching-neo4j-on-google-kubernetes-marketplace/2376 "2018-10-11T12:23:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![david\_allen](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/david_allen/32/13090_2.png) [@david\_allen](https://community.neo4j.com/u/david_allen)\
**Post date:** [October 11, 2018, 12:23pm UTC](https://community.neo4j.com/t/launching-neo4j-on-google-kubernetes-marketplace/2376/1 "2018-10-11T12:23:55Z")

</div>

This summer, Neo4j launched the ability to create graph clusters in managed Google Kubernetes instances. Check it out!

I'm also adding this as a thread on the community forum so that later folks can find it. You can feel free to post follow-up questions on this topic here, or in the #neo4j-graph-platform:cloud topic.

> **[Launching Neo4j on Google’s Kubernetes Marketplace](https://medium.com/google-cloud/launching-neo4j-on-googles-kubernetes-marketplace-97c23c94e960)**
>
> At the recent Cloud Next ’18 conference, Google announced the availability of Kubernetes applications in GCP marketplace. The gist of this…

---

<div class="post-metadata">

**Author:** ![greta](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/greta/32/56_2.png) [@greta](https://community.neo4j.com/u/greta)\
**Post date:** [October 11, 2018, 6:54pm UTC](https://community.neo4j.com/t/launching-neo4j-on-google-kubernetes-marketplace/2376/2 "2018-10-11T18:54:07Z")

</div>

Thanks for submitting!

I’ve added a tag that allows your blog to be displayed on the community home page!

---

<div class="post-metadata">

**Author:** ![greta](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/greta/32/56_2.png) [@greta](https://community.neo4j.com/u/greta)\
**Post date:** [October 11, 2018, 10:19pm UTC](https://community.neo4j.com/t/launching-neo4j-on-google-kubernetes-marketplace/2376/4 "2018-10-11T22:19:05Z")

</div>

Hi! To find out what I can do, say `@greta display help`.

---

<div class="post-metadata">

**Author:** ![brendan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/brendan/32/1437_2.png) [@brendan](https://community.neo4j.com/u/brendan)\
**Post date:** [November 5, 2018, 1:00am UTC](https://community.neo4j.com/t/launching-neo4j-on-google-kubernetes-marketplace/2376/5 "2018-11-05T01:00:16Z")

</div>

Hi @david_allen I've gone through this setup and your posts a few times but I'm missing a key detail... how do I connect to the cluster from my code? Normally I give py2neo a bolt or http address and a db username/password. I can't figure out what the address should be in Kubernetes.

---

<div class="post-metadata">

**Author:** ![david\_allen](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/david_allen/32/13090_2.png) [@david\_allen](https://community.neo4j.com/u/david_allen)\
**Post date:** [November 5, 2018, 2:25pm UTC](https://community.neo4j.com/t/launching-neo4j-on-google-kubernetes-marketplace/2376/6 "2018-11-05T14:25:21Z")

</div>

@brendan please check the limitations section here:

> <https://github.com/neo-technology/neo4j-google-k8s-marketplace/blob/main/user-guide/USER-GUIDE.md#limitations>

The cluster is exposed primarily inside of the kubernetes network, not outside. You can set up additional kubernetes things like NodePorts to expose individual pods if you like - one thing you might also want to do is check the SSH port forwarding section in those docs linked above to forward bolt.

Bolt+routing from outside of the kubernetes cluster is a bit problematic at the moment because of the way kubernetes networking works. We weren't able to provide default templates for this because much depends on your local network setting, but those docs there should help.

---

<div class="post-metadata">

**Author:** ![giriraj.bhojak](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/giriraj.bhojak/32/5885_2.png) [@giriraj.bhojak](https://community.neo4j.com/u/giriraj.bhojak)\
**Post date:** [August 2, 2019, 4:03pm UTC](https://community.neo4j.com/t/launching-neo4j-on-google-kubernetes-marketplace/2376/7 "2019-08-02T16:03:00Z")

</div>

Hello David,

We are trying to use Neo4j on GCP by deploying the causal cluster. We have a set of microservices deployed in another GKE cluster that would like to connect to Neo4j instance that sits in its own cluster.

Since this was posted in November last year, I would like to know if there has been any update to make it easier to connect to the Neo4j cluster.  
Would it make sense to expose a cluster IP that manages set of Neo4j nodes and use that IP from the microservices cluster to connect to Neo4j.  
We would like to avoid dealing with individual pods in Neo4j for the sake of connection.  
Would really appreciate any help in this regard.

Thanks,  
Giriraj

---

<div class="post-metadata">

**Author:** ![david\_allen](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/david_allen/32/13090_2.png) [@david\_allen](https://community.neo4j.com/u/david_allen)\
**Post date:** [August 2, 2019, 4:19pm UTC](https://community.neo4j.com/t/launching-neo4j-on-google-kubernetes-marketplace/2376/8 "2019-08-02T16:19:14Z")

</div>

There is some more information and suggested solutions around the limitations you can find here:

> **[Neo4j Considerations in Orchestration Environments](https://medium.com/neo4j/neo4j-considerations-in-orchestration-environments-584db747dca5)**
>
> Considerations for running Neo4j on Kubernetes and other Orchestration managers

We don't set this up for users directly though, because it depends on too many configuration aspects of the GKE cluster that we can't anticipate ahead of time in the packaging (like how you do DNS management).

From the outside you could create a DNS name that has multiple A records to point to all of the other cluster members, and then use bolt+routing to that. There are frankly a lot of ways to do it -- but it's for each organization to choose how they want to do this given their security posture and other configuration bits.

A core challenge here is that neo4j uses a smart client-based routing approach (bolt+routing) and Kubernetes really wants to treat all pods as indistinguishable from one another and front them with LBs, and these two approaches do not match well. It's a common situation for other databases in kubernetes as well that differentiate between cluster member roles in their architecture.

---

<div class="post-metadata">

**Author:** ![giriraj.bhojak](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/giriraj.bhojak/32/5885_2.png) [@giriraj.bhojak](https://community.neo4j.com/u/giriraj.bhojak)\
**Post date:** [August 19, 2019, 4:33pm UTC](https://community.neo4j.com/t/launching-neo4j-on-google-kubernetes-marketplace/2376/9 "2019-08-19T16:33:56Z")

</div>

Hi David,

Thank you for your detailed response earlier.  
For our dev environment on a GKE cluster in GCP, we have installed Neo4j Causal Cluster in the same cluster as our app microservices.

When trying to insert some seed data in the database, we connected to the cluster thru kubectl as follows:

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

Following is what we get as the after the connection succeeds:

`Connected to Neo4j 3.5.1 at bolt://causal-cluster-k8s-1-neo4j.default.svc.cluster.local:7687 as user neo4j.`

But when trying to insert some dummy data, we keep getting following:

`No write operations are allowed directly on this database. Writes must pass through the leader. The role of this server is: FOLLOWER`

Not sure what we are doing wrong here, it does seem like we are using bolt to connect to cypher shell.

We have three nodes in the dev envionment.  
Upon running dbms.cluster.overview(), I do see one of the nodes as the Leader and the other two as followers.

Could you please let me know if I am doing something wrong?  
Thank you once again for being thorough in your explanation of DNS in the GKE cluster.

Regards,  
Giriraj

---

<div class="post-metadata">

**Author:** ![david\_allen](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/david_allen/32/13090_2.png) [@david\_allen](https://community.neo4j.com/u/david_allen)\
**Post date:** [August 19, 2019, 4:47pm UTC](https://community.neo4j.com/t/launching-neo4j-on-google-kubernetes-marketplace/2376/10 "2019-08-19T16:47:31Z")

</div>

When you do this in that command:

```auto
-a $APP_INSTANCE_NAME-neo4j.default.svc.cluster.local

```

You are connecting to a DNS service name with a default bolt driver. Essentially your client is looking up the first available node (which happens to be a FOLLOWER) and then connecting you to that. Your writes then fail.

Change it to this:

```auto
-a bolt+routing://$APP_INSTANCE_NAME-neo4j.default.svc.cluster.local

```

This will have your client use a "Routing Driver" which will assure that the application itself routes the right query to the right machine.

> **[Client applications - Neo4j Driver Manual](https://neo4j.com/docs/driver-manual/1.7/client-applications/#routing_drivers_bolt_routing)**
>
> This section describes how to manage database connections within an application.

---

<div class="post-metadata">

**Author:** ![giriraj.bhojak](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/giriraj.bhojak/32/5885_2.png) [@giriraj.bhojak](https://community.neo4j.com/u/giriraj.bhojak)\
**Post date:** [August 19, 2019, 5:02pm UTC](https://community.neo4j.com/t/launching-neo4j-on-google-kubernetes-marketplace/2376/11 "2019-08-19T17:02:35Z")

</div>

You are so responsive, thank you very much for that !  
That routing change worked like a charm.  
Really excited to use Neo4j for our product.

Regards,  
Giriraj
