I am trying to setup neo4j in kubernetes using the helm charts and below is the values.yaml file I have used and modified few things like installing plugin and adding extra vars,
# Default values for Neo4j.
# This is a YAML-formatted file.
# Declare name/value pairs to be passed into your templates.
# name: value
name: "neo4j"
# Specs for the Neo4j docker image
image: "neo4j"
imageTag: "3.5.7"
imagePullPolicy: "IfNotPresent"
# imagePullSecret: registry-secret
acceptLicenseAgreement: "no"
podDisruptionBudget: {}
# minAvailable: 2
# maxUnavailable: 1
# Use password authentication
authEnabled: true
## Specify password for neo4j user
## Defaults to a random 10-character alphanumeric string if not set and authEnabled is true
neo4jPassword: changeme
# Specify cluster domain (used eg. as suffix in definition of NEO4J_causal__clustering_initial__discovery__members environment variable)
clusterDomain: "cluster.local"
# Specs for the images used for running tests against the Helm package
testImage: "markhneedham/k8s-kubectl"
testImageTag: "master"
# Cores
core:
numberOfServers: 3
persistentVolume:
## whether or not persistence is enabled
##
enabled: true
## core server data Persistent Volume mount root path
##
mountPath: /data
## core server data Persistent Volume size
##
size: 10Gi
## core server data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
## storageClass: "-"
## Subdirectory of core server data Persistent Volume to mount
## Useful if the volume's root directory is not empty
##
## subPath: ""
## Pass extra environment variables to the Neo4j container.
##
extraVars:
- name: com.graphaware.module.ES.uri
value: elasticsearch
# - name: EXTRA_VAR_2
# value: extra-var-value-2
sidecarContainers: []
## Additional containers to be added to the Neo4j core pod.
# - name: my-sidecar
# image: nginx:latest
initContainers: []
## init containers to run before the Neo4j core pod e.g. to install plugins
- name: init-plugins
image: "appropriate/curl:latest"
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: plugins
mountPath: /plugins
command:
- "/bin/sh"
- "-c"
- |
curl -L https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.2.0.3/apoc-3.2.0.3-all.jar -O
cp apoc-3.2.0.3-all.jar /plugins/
# Read Replicas
readReplica:
numberOfServers: 0
## Pass extra environment variables to the Neo4j container.
##
# extraVars:
# - name: EXTRA_VAR_1
# value: extra-var-value-1
# - name: EXTRA_VAR_2
# value: extra-var-value-2
sidecarContainers: []
## Additional containers to be added to the Neo4j replica pod.
# - name: my-sidecar
# image: nginx:latest
initContainers: []
## init containers to run before the Neo4j replica pod e.g. to install plugins
# - name: init-plugins
# image: "appropriate/curl:latest"
# imagePullPolicy: "IfNotPresent"
# volumeMounts:
# - name: plugins
# mountPath: /plugins
# command:
# - "/bin/sh"
# - "-c"
# - |
# curl -L https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.2.0.3/apoc-3.2.0.3-all.jar -O
# cp apoc-3.2.0.3-all.jar /plugins/
resources: {}
# limits:
# cpu: 100m
# memory: 512Mi
# requests:
# cpu: 100m
# memory: 512Mi
Below is the command i execute and getting the response,
ubuntu@:~/KubernetesCluster/elasticsearch7/neo4j$ helm install --name neo4j-community stable/neo4j -f ./test.yaml
Error: failed to parse ./test.yaml: error converting YAML to JSON: yaml: line 76: did not find expected key
I followed the default values.yaml and modified the changes, I suspect the indentation is not properly given in yaml and the error line 76 where I defined the command for install plugin in neo4j and I did tried changing the indentation inside yaml but didn't worked.
Also inside the values.yaml I defined the extra environment variable for neo4j container and these values are not passed to neo4j conf
## Pass extra environment variables to the Neo4j container.
##
extraVars:
- name: com.graphaware.module.ES.uri
value: elasticsearch
Please correct me if I am doing anything wrong in the values.yaml
It would help if you posted your full YAML and identified exactly which line is line 76. Indeed it does sound like you have a formatting issue.
It sounds like you've made more than just these changes to the kubernetes yaml because you're installing neo4j-community, and applying "test.yaml" - which is fine - but it's hard to spot what's going wrong without the full YAML.
Additionally as a debugging step I'd suggest not using "extraVars" to set environment variables, but instead to set them directly in the pod, like here:
This would help eliminate as a source of an error helm incorrectly substituting those vars into a separate template.
# Default values for Neo4j.
# This is a YAML-formatted file.
# Declare name/value pairs to be passed into your templates.
# name: value
name: "neo4j"
# Specs for the Neo4j docker image
image: "neo4j"
imageTag: "3.5.7"
imagePullPolicy: "IfNotPresent"
# imagePullSecret: registry-secret
acceptLicenseAgreement: "no"
podDisruptionBudget: {}
# minAvailable: 2
# maxUnavailable: 1
# Use password authentication
authEnabled: true
## Specify password for neo4j user
## Defaults to a random 10-character alphanumeric string if not set and authEnabled is true
neo4jPassword: changeme
# Specify cluster domain (used eg. as suffix in definition of NEO4J_causal__clustering_initial__discovery__members environment variable)
clusterDomain: "cluster.local"
# Specs for the images used for running tests against the Helm package
testImage: "markhneedham/k8s-kubectl"
testImageTag: "master"
# Cores
core:
numberOfServers: 3
persistentVolume:
## whether or not persistence is enabled
##
enabled: true
## core server data Persistent Volume mount root path
##
mountPath: /data
## core server data Persistent Volume size
##
size: 10Gi
## core server data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
## storageClass: "-"
## Subdirectory of core server data Persistent Volume to mount
## Useful if the volume's root directory is not empty
##
## subPath: ""
## Pass extra environment variables to the Neo4j container.
##
extraVars:
- name: com.graphaware.module.ES.uri
value: elasticsearch
# - name: EXTRA_VAR_2
# value: extra-var-value-2
sidecarContainers: []
## Additional containers to be added to the Neo4j core pod.
# - name: my-sidecar
# image: nginx:latest
initContainers: []
## init containers to run before the Neo4j core pod e.g. to install plugins
- name: init-plugins
image: "appropriate/curl:latest"
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: plugins
mountPath: /plugins
command:
- "/bin/sh"
- "-c"
- |
curl -L https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.2.0.3/apoc-3.2.0.3-all.jar -O
cp apoc-3.2.0.3-all.jar /plugins/
# Read Replicas
readReplica:
numberOfServers: 0
## Pass extra environment variables to the Neo4j container.
##
# extraVars:
# - name: EXTRA_VAR_1
# value: extra-var-value-1
# - name: EXTRA_VAR_2
# value: extra-var-value-2
sidecarContainers: []
## Additional containers to be added to the Neo4j replica pod.
# - name: my-sidecar
# image: nginx:latest
initContainers: []
## init containers to run before the Neo4j replica pod e.g. to install plugins
# - name: init-plugins
# image: "appropriate/curl:latest"
# imagePullPolicy: "IfNotPresent"
# volumeMounts:
# - name: plugins
# mountPath: /plugins
# command:
# - "/bin/sh"
# - "-c"
# - |
# curl -L https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.2.0.3/apoc-3.2.0.3-all.jar -O
# cp apoc-3.2.0.3-all.jar /plugins/
resources: {}
# limits:
# cpu: 100m
# memory: 512Mi
# requests:
# cpu: 100m
# memory: 512Mi
Yes right I tried its worked but i wanted to test "extraVars" to pass the paramaters to neo4j conf but for me it didn't worked..
Sadly this template needs to be fairly re-organized. What it is saying is that you wish to create 3 independent copies of neo4j community, which is not a sensible thing to do. Community does not support clustering.
I think what you're trying to do here is to deploy a SINGLE community container in kubernetes. You're better off reading the docker documentation for Neo4j and writing your own single YAML file from scratch, because the way the cluster config is being adapted for community is causing you more issues than it's solving here.
From the original cluster YAML, you've removed the StatefulSet declaration, but you didn't declare this as a separate kubernetes resource spec.
So I'm sorry as I know this is a high-effort suggestion, but I recommend you start from square 1 with an eye towards what you're trying to deploy.
the PVCs that are used by the helm chart follow predictable naming patterns. So while you can't configure what you're asking for directly, what you can do is pre-prepare the PVC that you want mounted under the right name. If the PVC already exists, neo4j will not re-create it, it'll just use whatever is there. And so by naming the PVC strategically, you can stage whatever data & volume you wish, and plug it into the helm chart.
Would you consider the change to allow PVCs names provided as variables in the next release of the chart?
I my case it would be preferable option rather that pre-build PVCs (or modify chart)?