diff --git a/charts/memgraph-high-availability/README.md b/charts/memgraph-high-availability/README.md index 0c3e42e..abeea7f 100644 --- a/charts/memgraph-high-availability/README.md +++ b/charts/memgraph-high-availability/README.md @@ -1,5 +1,5 @@ -## Helm chart for Memgraph high availability cluster (Enterprise) -A Helm Chart for deploying Memgraph in [high availability setup](https://memgraph.com/docs/clustering/high-availability). This helm chart requires an enterprise version of Memgraph. +# Helm chart for Memgraph high availability (HA) cluster (Enterprise) +A Helm Chart for deploying Memgraph in [high availability setup](https://memgraph.com/docs/clustering/high-availability). This Helm Chart requires an [Enterprise version of Memgraph](https://memgraph.com/docs/database-management/enabling-memgraph-enterprise). Memgraph HA cluster includes 3 coordinators, 2 data instances by default. The cluster setup is performed via the cluster-setup job. The HA cluster is still work in progress and started with "--experimental-enabled=high-availability". The cluster is started in the configuration without the node selector, which means that in the current configuration, it is not highly available if the node fails. @@ -21,11 +21,24 @@ Or you can modify a `values.yaml` file and override the desired values: helm install memgraph/memgraph-high-availability -f values.yaml ``` +## Running the Memgraph HA Helm Chart locally + +To run Memgraph HA Helm Chart locally, affinity needs to be disabled because the cluster will be running on a single node. + +To disable the affinity, run the following command with the specified set of flags: + +``` +helm install memgraph/memgraph-high-availability --set memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE=,memgraph.env.MEMGRAPH_ORGANIZATION_NAME=,memgraph.affinity.enabled=false +``` + +The affinity is disabled either by running the command above, or by modifying the `values.yaml` file. + ## Configuration Options The following table lists the configurable parameters of the Memgraph chart and their default values. + | Parameter | Description | Default | |---------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------| | `memgraph.image.repository` | Memgraph Docker image repository | `memgraph/memgraph` | @@ -55,6 +68,8 @@ The following table lists the configurable parameters of the Memgraph chart and | `memgraph.ports.coordinatorPort` | Coordinator port used on coordinators. | `12000` | | `data` | Configuration for data instances | See `data` section | | `coordinators` | Configuration for coordinator instances | See `coordinators` section | +| `sysctlInitContainer.enabled` | Enable the init container to set sysctl parameters | `true` | +| `sysctlInitContainer.maxMapCount` | Value for `vm.max_map_count` to be set by the init container | `262144` | For the `data` and `coordinators` sections, each item in the list has the following parameters: @@ -63,6 +78,7 @@ For the `data` and `coordinators` sections, each item in the list has the follow | `id` | ID of the instance | `0` for data, `1` for coordinators | | `args` | List of arguments for the instance | See `args` section | + The `args` section contains a list of arguments for the instance. The default values are the same for all instances: ```markdown diff --git a/charts/memgraph-high-availability/templates/coordinators.yaml b/charts/memgraph-high-availability/templates/coordinators.yaml index c6d329a..6511096 100644 --- a/charts/memgraph-high-availability/templates/coordinators.yaml +++ b/charts/memgraph-high-availability/templates/coordinators.yaml @@ -53,6 +53,15 @@ spec: add: [ "CHOWN" ] runAsUser: 0 runAsNonRoot: false + {{- if $.Values.sysctlInitContainer.enabled }} + - name: init-sysctl + image: busybox + command: ['sh', '-c', 'sysctl -w vm.max_map_count={{ $.Values.sysctlInitContainer.maxMapCount }}'] + securityContext: + privileged: true + runAsUser: 0 + {{- end }} + containers: - name: memgraph-coordinator image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}" diff --git a/charts/memgraph-high-availability/templates/data.yaml b/charts/memgraph-high-availability/templates/data.yaml index 2ec45ad..e588922 100644 --- a/charts/memgraph-high-availability/templates/data.yaml +++ b/charts/memgraph-high-availability/templates/data.yaml @@ -53,6 +53,15 @@ spec: add: [ "CHOWN" ] runAsUser: 0 runAsNonRoot: false + {{- if $.Values.sysctlInitContainer.enabled }} + - name: init-sysctl + image: busybox + command: ['sh', '-c', 'sysctl -w vm.max_map_count={{ $.Values.sysctlInitContainer.maxMapCount }}'] + securityContext: + privileged: true + runAsUser: 0 + {{- end }} + containers: - name: memgraph-data image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}" diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml index ef2fbf6..ec04309 100644 --- a/charts/memgraph-high-availability/values.yaml +++ b/charts/memgraph-high-availability/values.yaml @@ -42,6 +42,13 @@ memgraph: coordLoadBalancer: enabled: true +# If you are experiencing issues with the sysctlInitContainer, you can disable it here. +# This is made to increase the max_map_count, necessary for high memory loads in Memgraph +# If you are experiencing crashing pod with the: Max virtual memory areas vm.max_map_count is too low +# you can increase the maxMapCount value. +sysctlInitContainer: + enabled: true + maxMapCount: 262144 data: - id: "0" diff --git a/charts/memgraph/README.md b/charts/memgraph/README.md index d4a12bd..5582b0a 100644 --- a/charts/memgraph/README.md +++ b/charts/memgraph/README.md @@ -78,7 +78,8 @@ The following table lists the configurable parameters of the Memgraph chart and | `probes.startup.failureThreshold` | Failure threshold for startup probe | `30` | | `nodeSelectors` | Node selectors for pod. Left empty by default. | `{}` | | `customQueryModules` | List of custom Query modules that should be mounted to Memgraph Pod | `[]` | - +| `sysctlInitContainer.enabled` | Enable the init container to set sysctl parameters | `true` | +| `sysctlInitContainer.maxMapCount` | Value for `vm.max_map_count` to be set by the init container | `262144` | **Note:** It's often recommended not to specify default resources and leave it as a conscious choice for the user. If you want to specify resources, uncomment the following lines in your `values.yaml`, adjust them as necessary: ```yaml diff --git a/charts/memgraph/templates/statefulset.yaml b/charts/memgraph/templates/statefulset.yaml index 3b55c5d..d9aa1b3 100644 --- a/charts/memgraph/templates/statefulset.yaml +++ b/charts/memgraph/templates/statefulset.yaml @@ -69,7 +69,14 @@ spec: add: ["CHOWN"] runAsUser: 0 runAsNonRoot: false - + {{- if .Values.sysctlInitContainer.enabled }} + - name: init-sysctl + image: busybox + command: ['sh', '-c', 'sysctl -w vm.max_map_count={{ .Values.sysctlInitContainer.maxMapCount }}'] + securityContext: + privileged: true + runAsUser: 0 + {{- end }} terminationGracePeriodSeconds: {{ .Values.container.terminationGracePeriodSeconds }} securityContext: {{- if .Values.useImagePullSecrets }} diff --git a/charts/memgraph/values.yaml b/charts/memgraph/values.yaml index 0600f3c..b05730d 100644 --- a/charts/memgraph/values.yaml +++ b/charts/memgraph/values.yaml @@ -20,6 +20,7 @@ affinity: nodeKey: nodeValue: + nodeSelector: {} tolerations: [] @@ -120,7 +121,6 @@ serviceAccount: # If not set and create is true, a name is generated using the fullname template name: "" - container: terminationGracePeriodSeconds: 1800 probes: @@ -145,3 +145,12 @@ customQueryModules: [] # - volume: "" # Must be present in the ConfigMap referenced with `volume` # file: "" + + +# If you are experiencing issues with the sysctlInitContainer, you can disable it here. +# This is made to increase the max_map_count, necessary for high memory loads in Memgraph +# If you are experiencing crashing pod with the: Max virtual memory areas vm.max_map_count is too low +# you can increase the maxMapCount value. +sysctlInitContainer: + enabled: true + maxMapCount: 262144