# Access to Neo4j service running inside a Kubernetes Cluster

**URL:** <https://community.neo4j.com/t/access-to-neo4j-service-running-inside-a-kubernetes-cluster/47841>\
**Category:** Cluster\
**Tags:** kubernetes\
**Created:** [November 22, 2021, 12:46pm UTC](https://community.neo4j.com/t/access-to-neo4j-service-running-inside-a-kubernetes-cluster/47841 "2021-11-22T12:46:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariaplerou](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/mariaplerou/32/14937_2.png) [@mariaplerou](https://community.neo4j.com/u/mariaplerou)\
**Post date:** [November 22, 2021, 12:46pm UTC](https://community.neo4j.com/t/access-to-neo4j-service-running-inside-a-kubernetes-cluster/47841/1 "2021-11-22T12:46:17Z")

</div>

Hello all,

1. Hi all, I have deployed neo4j deployment with helm charts from github [GitHub - neo4j-contrib/neo4j-helm: Helm Charts for running Neo4j on Kubernetes [DEPRECATED]](https://github.com/neo4j-contrib/neo4j-helm) to a k8s cluster.  
version/ edition: 4.3.6" / "enterprise".  
The deployment is successful with 3 pods running and clusterIP service (Nodeport also works ok).  
In the exec mode of a pod in the same K8s cluster, a python script (using neo4j GraphDatabase library) is running, the python script is able to connect to neo4j DB with username and password and then is able to execute successfully a query like " RETURN apoc.version() AS output;", so READ access to neo4j service seems to be working ok.  
But when the pod tries to have write access with the example query :  
`"CREATE (n:Person {name: 'Andy', title: 'Developer'})"` the response from the 2 out of the 3 pods is

- 

> "Query failed: No write service available for pool \<BoltPool address=IPv4Address"

- 

The structure of bolt URL is like the following :  
` bolt://<pod_name>.<service>.<namespase>.svc.cluster.local:7687`.  
The fact that only in one of the 3 pods my script can run means to me that there is a serving pod each time **randomly** to which you can write. But neither its IP or bolt URL can be predefined.  
I need something more **generic** in order to **access** neo4j cluster from another pod.  
Could you please advise on something more generic in order to acccess neo4j service using bolt protocol (I need bold because I will use it with neomodel which has bolt as prerequisite) always inside the K8s cluster ?

I also tried deployment of neo4j cluster (3 pods) with Nodeport service and tried to use  
` bolt://<NodePort_IP:7687`. but without success.

Any ideas?  
Thank you in advance,  
Mary

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [November 22, 2021, 12:52pm UTC](https://community.neo4j.com/t/access-to-neo4j-service-running-inside-a-kubernetes-cluster/47841/2 "2021-11-22T12:52:58Z")

</div>

@mariaplerou

if you change

```auto
The structure of bolt URL is like the following :
bolt://<pod_name>.<service>.<namespase>.svc.cluster.local:7687.

```

to

```auto
The structure of bolt URL is like the following :
neo4j://<pod_name>.<service>.<namespase>.svc.cluster.local:7687.

```

does this resolve your WRITE issue.

connecting with `bolt://` effectively says go to a given cluster member and stay there.  
Where as `ne4j://` effectively says go to a given cluster member but WRITES will be automatically routed to the LEADER, even if it is at another cluster member, and provided the query is submiited via session.writeTransaction or similar

---

<div class="post-metadata">

**Author:** ![mariaplerou](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/mariaplerou/32/14937_2.png) [@mariaplerou](https://community.neo4j.com/u/mariaplerou)\
**Post date:** [November 23, 2021, 2:08pm UTC](https://community.neo4j.com/t/access-to-neo4j-service-running-inside-a-kubernetes-cluster/47841/3 "2021-11-23T14:08:46Z")

</div>

Yes, It works now with `ne4j://` but do you know if there is compatibility with neomodel, as I use this in order to create nodes and relationships via python?

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [November 23, 2021, 6:52pm UTC](https://community.neo4j.com/t/access-to-neo4j-service-running-inside-a-kubernetes-cluster/47841/4 "2021-11-23T18:52:26Z")

</div>

and correction. my last post mentions `ne4j://` when it should be `neo4j://`

As to does it work with neomodel? the usage is provided through a Neo4j database driver. So provided connection is through a Neo4j driver you should be all set
