diff --git a/README.md b/README.md index b129d1e..ab2e966 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Given this, I'm going to demonstrate how to provision a (near, as storage is sti ## (Very) Important notes * By default, `ES_JAVA_OPTS` is set to `-Xms256m -Xmx256m`. This is a *very low* value but many users, i.e. `minikube` users, were having issues with pods getting killed because hosts were out of memory. -You can change this yourself in the deployment descriptors available in this repository. +You can change this yourself in the `es-config.yaml` ConfigMap available in this repository. * As of the moment, Kubernetes pod descriptors use an `emptyDir` for storing data in each data node container. This is meant to be for the sake of simplicity and should be adapted according to your storage needs. @@ -31,13 +31,17 @@ Providing your own version of [the images automatically built from this reposito ``` kubectl create -f es-discovery-svc.yaml kubectl create -f es-svc.yaml +kubectl create -f es-config.yaml +kubectl create -f es-master-config.yaml kubectl create -f es-master.yaml ``` Wait until `es-master` deployment is provisioned, and ``` +kubectl create -f es-client-config.yaml kubectl create -f es-client.yaml +kubectl create -f es-data-config.yaml kubectl create -f es-data.yaml ``` Now, I leave up to you how to validate the cluster, but a first step is to wait for containers to be in the `Running` state and check Elasticsearch master logs: diff --git a/es-client-config.yaml b/es-client-config.yaml new file mode 100644 index 0000000..8d35cd1 --- /dev/null +++ b/es-client-config.yaml @@ -0,0 +1,8 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: es-client-config +data: + NODE_MASTER: "false" + NODE_DATA: "false" + HTTP_ENABLE: "true" \ No newline at end of file diff --git a/es-client.yaml b/es-client.yaml index d476ec8..920df69 100644 --- a/es-client.yaml +++ b/es-client.yaml @@ -39,16 +39,31 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - - name: "CLUSTER_NAME" - value: "myesdb" + - name: CLUSTER_NAME + valueFrom: + configMapKeyRef: + name: es-config + key: CLUSTER_NAME + - name: ES_JAVA_OPTS + valueFrom: + configMapKeyRef: + name: es-config + key: ES_JAVA_OPTS - name: NODE_MASTER - value: "false" + valueFrom: + configMapKeyRef: + name: es-client-config + key: NODE_MASTER - name: NODE_DATA - value: "false" + valueFrom: + configMapKeyRef: + name: es-client-config + key: NODE_DATA - name: HTTP_ENABLE - value: "true" - - name: "ES_JAVA_OPTS" - value: "-Xms256m -Xmx256m" + valueFrom: + configMapKeyRef: + name: es-client-config + key: HTTP_ENABLE ports: - containerPort: 9200 name: http diff --git a/es-config.yaml b/es-config.yaml new file mode 100644 index 0000000..fb9e24c --- /dev/null +++ b/es-config.yaml @@ -0,0 +1,7 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: es-config +data: + CLUSTER_NAME: "myesdb" + ES_JAVA_OPTS: "-Xms256m -Xmx256m" diff --git a/es-data-config.yaml b/es-data-config.yaml new file mode 100644 index 0000000..28a2804 --- /dev/null +++ b/es-data-config.yaml @@ -0,0 +1,8 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: es-data-config +data: + NODE_MASTER: "false" + NODE_INGEST: "false" + HTTP_ENABLE: "false" diff --git a/es-data.yaml b/es-data.yaml index d49b7ab..655ba54 100644 --- a/es-data.yaml +++ b/es-data.yaml @@ -39,16 +39,31 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - - name: "CLUSTER_NAME" - value: "myesdb" + - name: CLUSTER_NAME + valueFrom: + configMapKeyRef: + name: es-config + key: CLUSTER_NAME + - name: ES_JAVA_OPTS + valueFrom: + configMapKeyRef: + name: es-config + key: ES_JAVA_OPTS - name: NODE_MASTER - value: "false" + valueFrom: + configMapKeyRef: + name: es-data-config + key: NODE_MASTER - name: NODE_INGEST - value: "false" + valueFrom: + configMapKeyRef: + name: es-data-config + key: NODE_INGEST - name: HTTP_ENABLE - value: "false" - - name: "ES_JAVA_OPTS" - value: "-Xms256m -Xmx256m" + valueFrom: + configMapKeyRef: + name: es-data-config + key: HTTP_ENABLE ports: - containerPort: 9300 name: transport diff --git a/es-master-config.yaml b/es-master-config.yaml new file mode 100644 index 0000000..dc58f70 --- /dev/null +++ b/es-master-config.yaml @@ -0,0 +1,10 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: es-master-config +data: + NUMBER_OF_MASTERS: "2" + NODE_MASTER: "true" + NODE_INGEST: "false" + NODE_DATA: "false" + HTTP_ENABLE: "false" diff --git a/es-master.yaml b/es-master.yaml index a9b9a91..39a37fd 100644 --- a/es-master.yaml +++ b/es-master.yaml @@ -39,20 +39,41 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - - name: "CLUSTER_NAME" - value: "myesdb" - - name: "NUMBER_OF_MASTERS" - value: "2" + - name: CLUSTER_NAME + valueFrom: + configMapKeyRef: + name: es-config + key: CLUSTER_NAME + - name: ES_JAVA_OPTS + valueFrom: + configMapKeyRef: + name: es-config + key: ES_JAVA_OPTS + - name: NUMBER_OF_MASTERS + valueFrom: + configMapKeyRef: + name: es-master-config + key: NUMBER_OF_MASTERS - name: NODE_MASTER - value: "true" + valueFrom: + configMapKeyRef: + name: es-master-config + key: NODE_MASTER - name: NODE_INGEST - value: "false" + valueFrom: + configMapKeyRef: + name: es-master-config + key: NODE_INGEST - name: NODE_DATA - value: "false" + valueFrom: + configMapKeyRef: + name: es-master-config + key: NODE_DATA - name: HTTP_ENABLE - value: "false" - - name: "ES_JAVA_OPTS" - value: "-Xms256m -Xmx256m" + valueFrom: + configMapKeyRef: + name: es-master-config + key: HTTP_ENABLE ports: - containerPort: 9300 name: transport