Access to Neo4j service running inside a Kubernetes Cluster

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

@mariaplerou

if you change

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

to

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

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?

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