For smaller environments it’s possible to downsize most of the containers to 1 instance. Except for redis, mongo and elasticsearch. Checking the statefulsets, redis requires 75M to 1G, mongo from 50M to 200M, elasticsearch from 3Gi to 4Gi.
Reducing the pods for redis and mongo is not an option.
Example scale for mw-proxy
kubectl -n connections get deployments kubectl -n connections scale --replicas=1 deployment/mw-proxy
So I focused on elasticsearch. There are 2 options. Reducing memory consumption and reducing the number of pods.
Reduce the memory requirements can be achieved if you look at the helm chart.
helm show values elasticsearch7-0.1.0-20210427-114731.tgz > elasticsearch.yml
There you get all the parameters that can be set by helm.
So for my testenvironment I ended with this yaml file:
client: ES_JAVA_OPTS_XMS: -Xms512m ES_JAVA_OPTS_XMX: -Xmx512m replicas: 2 resources: limits: cpu: '2' mem: 2048Mi requests: cpu: '0.1' mem: 1024Mi common: storageClassName: nfs-client storageSize: 8Gi data: ES_JAVA_OPTS_XMS: -Xms768m ES_JAVA_OPTS_XMX: -Xmx768m replicas: 2 resources: limits: cpu: '2' mem: 4096Mi requests: cpu: '0.5' mem: 2048Mi image: repository: harbor-lab.belsoft.ch:443/connections tag: 20210427-114731 master: ES_JAVA_OPTS_XMS: -Xms512m ES_JAVA_OPTS_XMX: -Xmx512m replicas: 2 resources: limits: cpu: '1' mem: 1024Mi requests: cpu: '0.1' mem: 512Mi namespace: connect6 nodeAffinityRequired: false createSecret: false rollingUpdate: maxSurge: 1 maxUnavailable: 0 tag: 20210427-114731
That’s just a first try, maybe it can be reduced even a bit more agressive.
I used this to install the helm chart.
This setup requires some additional adjustments before you connect connections to elasticsearch:
a) change the number of replicas for quickresults. I reduced the es-data to 2 pods, so the replica count should be set to 1 (default is 2). If you don’t adjust this value, the index will have a yellow or red status.
b) It might be usefull to reduce the shard counter if you plan to use metrics.
If you reduce the number of pods for elasticsearch after your indices have been created you may have a look at the index modules api to bring your indices into a green state.