Kubernetes : Neo4j Customization
Category : DevOps Tag : gds kubernetes
April 21, 2022, 10:06 p.m.

Short Description :
Follow up from previous neo4j helm deployment for a customization
source : datak

<p><p></p><p>This is a follow up from&nbsp;<a href="https://lab.datak.biz/blog/detail/66/" target="_blank">previous blog</a>&nbsp;for neo4j helm deployment at k8s.</p><p><br></p><h2>Debugging</h2><p>Following script will typically find a container related issues</p><p>1. Typical overall log from pod</p><pre>#shell kubectl describe pod &lt;your pod name&gt;</pre><p>2. Typical detail log from pod</p><pre>#shell kubectl logs &lt;your pod name&gt;</pre><p>3. Neo4j specific event log</p><pre>#shell kubectl exec &lt;your pod name&gt; -- tail -n50 /logs/neo4j.log</pre><p>4. If pod is running you can look into container inside by;</p><pre>#shell kubectl exec -it &lt;your pod name&gt; -- bash</pre><p>which is similar to `docker exec -it &lt;container id&gt; bin/bash`</p><p><br></p><h2>How to use secret repository</h2><p><a href="https://neo4j.com/docs/operations-manual/current/kubernetes/maintenance/#imagepullsecrets" target="_blank">Reference</a><br></p><pre>#neo4j config.yaml image: imagePullSecrets: - "secret name" #if you are not using k8s platform app to create a secret &nbsp;&nbsp;imageCredentials: - registry: "address" username: "" password: "" email: "" name: ""</pre><h2>How to add plugins/create customized container</h2><p>Note, neo4j helm has neo4j container compatibility, neo4j docker version &gt;4.3.0. My workable solution is following&nbsp;<a href="https://neo4j.com/docs/operations-manual/current/kubernetes/configuration/#custom-container" target="_blank">the neo4j doc</a>.<br><br>1. Create personalized dockerfile based on neo4j official docker<br></p><pre>#dockerfile FROM neo4j:&lt;version &gt;4.3.0&gt; ########################## #proxy settings #environmental setting for proxy when the container run ENG http_proxy "proxy URL" #configure proxy in apt RUN echo '\ Acquire::http::proxy "proxy URL" ' &gt; /etc/apt/apt.conf ########################## #environmental settings for neo4j configurations ENV NEO4J_ACCEPT_LICENSE_AGREEMENT=yes ENV NEO4J_AUTH=neo4j/&lt;your neo4j login password here for basic auth&gt; ENV apoc.import.file.enabled=true ENV apoc.export.file.enabled=true ENV apoc.export.json.all=true #install plugins ENV NEO4JLABS_PLUGINS='["apoc","graph-data-science","bloom"]'</pre><p>2. Push the image to the repository by;<br></p><pre>#shell docker build .. docker push ..</pre>3.Add the repo and image name in config.yaml. <span style="background-color: rgb(255, 255, 0);">Note that if you change docker image and push to the repo, you need to change the tag, otherwise helm will not reflect the changes</span></p><p><span style="background-color: rgb(255, 255, 0);">Also another note that you will need to disable couple of security so the plugins can access the neo4j databse<br></span><p></p><p></p><pre>#config.yaml image: customImage: "&lt;registry URL&gt;/&lt;namespace&gt;/&lt;image&gt;/&lt;tag&gt;" imagePullSecrets: - &lt;secret name&gt; #enable that plugins can access to the database config: dbms.config.strict_validation: "fase" dbms.security.procedures.unrestricted: "apoc.*" dbms.security.procedures.unrestricted: "bloom.*" dbms.unmanaged_extension_classes: "com.neo4j.bloom.server=/browser/bloom"</pre>4. Upgrade helm chart. It would be safe to use same version from helm (neo4h helm version is same as neo4j docker version)<br><pre>#shell helm upgrade &lt;your helm name&gt; neo4j/neo4j-standalone --version &lt;version&gt; --set volumes.data.mode=defaultStorageClass -f config.yaml</pre>5. Check helm version<br><pre>#shell helm list</pre><p><br></p><h2>How to add license</h2><p><br></p><p><br></p><h2>How to create a persistent storage</h2><p>Just follow volume settings in `config.yaml` and `helm upgrade` in previous blog, and that will automatically created persistent storage. For Rancher, it will automatically mount and for local minikube it will create new directory under home</p><p><br></p><p></p></p>


<< Back to Blog Posts
Back to Home

Related Posts

Kubernetes : Python + Neo4j Analytics Environment : JupyterHub
Apr 17 2022
How to use jupyterhub helm and deploy jupyterhub in local k8s (Minikube)
Kubernetes : Python + Neo4j Analytics Environment : Neo4j
Apr 18 2022
How to use neo4j helm and deploy neo4j in local k8se (Minikube)



© DATAK 2024