From c46279b61c43bcbb0f7b0cae1850415a99452627 Mon Sep 17 00:00:00 2001 From: Max Schmidt Date: Fri, 14 Feb 2020 10:31:36 +0100 Subject: [PATCH 1/5] Add custom readinessprobe possibility --- elasticsearch/README.md | 7 ++++--- elasticsearch/templates/statefulset.yaml | 13 +++++++++++-- elasticsearch/values.yaml | 17 ++++++++++++++--- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/elasticsearch/README.md b/elasticsearch/README.md index fedd45838..3d5202819 100644 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -123,8 +123,8 @@ helm install --name elasticsearch elastic/elasticsearch --set imageTag=7.6.0 | `nodeAffinity` | Value for the [node affinity settings](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity-beta-feature) | `{}` | | `podManagementPolicy` | By default Kubernetes [deploys statefulsets serially](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#pod-management-policies). This deploys them in parallel so that they can discover eachother | `Parallel` | | `protocol` | The protocol that will be used for the readinessProbe. Change this to `https` if you have `xpack.security.http.ssl.enabled` set | `http` | -| `httpPort` | The http port that Kubernetes will use for the healthchecks and the service. If you change this you will also need to set [http.port](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-http.html#_settings) in `extraEnvs` | `9200` | -| `transportPort` | The transport port that Kubernetes will use for the service. If you change this you will also need to set [transport port configuration](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-transport.html#_transport_settings) in `extraEnvs` | `9300` | +| `httpPort` | The http port that Kubernetes will use for the healthchecks and the service. If you change this you will also need to set [http.port](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-http.html#_settings) in `extraEnvs` | `9200` | +| `transportPort` | The transport port that Kubernetes will use for the service. If you change this you will also need to set [transport port configuration](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-transport.html#_transport_settings) in `extraEnvs` | `9300` | | `service.labels` | Labels to be added to non-headless service | `{}` | | `service.labelsHeadless` | Labels to be added to headless service | `{}` | | `service.type` | Type of elasticsearch service. [Service Types](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types) | `ClusterIP` | @@ -140,7 +140,8 @@ helm install --name elasticsearch elastic/elasticsearch --set imageTag=7.6.0 | `terminationGracePeriod` | The [terminationGracePeriod](https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods) in seconds used when trying to stop the pod | `120` | | `sysctlInitContainer.enabled` | Allows you to disable the sysctlInitContainer if you are setting vm.max_map_count with another method | `true` | | `sysctlVmMaxMapCount` | Sets the [sysctl vm.max_map_count](https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html#vm-max-map-count) needed for Elasticsearch | `262144` | -| `readinessProbe` | Configuration fields for the [readinessProbe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/) | `failureThreshold: 3`
`initialDelaySeconds: 10`
`periodSeconds: 10`
`successThreshold: 3`
`timeoutSeconds: 5` | +| `readinessProbe` | Configuration fields for the [readinessProbe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/) and optional custom readinessprobe | `failureThreshold: 3`
`initialDelaySeconds: 10`
`periodSeconds: 10`
`successThreshold: 3`
`timeoutSeconds: 5` | +| `readinessProbe.custom` | Configuration fields for a custom readinessProbe to use instead of the default one | `{}` | | `clusterHealthCheckParams` | The [Elasticsearch cluster health status params](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html#request-params) that will be used by readinessProbe command | `wait_for_status=green&timeout=1s` | | `imagePullSecrets` | Configuration for [imagePullSecrets](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-pod-that-uses-your-secret) so that you can use a private registry for your image | `[]` | | `nodeSelector` | Configurable [nodeSelector](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) so that you can target specific nodes for your Elasticsearch cluster | `{}` | diff --git a/elasticsearch/templates/statefulset.yaml b/elasticsearch/templates/statefulset.yaml index c2a63fb79..f75fa2645 100644 --- a/elasticsearch/templates/statefulset.yaml +++ b/elasticsearch/templates/statefulset.yaml @@ -191,8 +191,16 @@ spec: {{ toYaml .Values.securityContext | indent 10 }} image: "{{ .Values.image }}:{{ .Values.imageTag }}" imagePullPolicy: "{{ .Values.imagePullPolicy }}" + {{- if .Values.readinessProbe.customProbe }} readinessProbe: -{{ toYaml .Values.readinessProbe | indent 10 }} + {{ toYaml .Values.readinessProbe.customProbe | indent 10 | trim}} + {{- else }} + readinessProbe: + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} exec: command: - sh @@ -226,6 +234,7 @@ spec: exit 1 fi fi + {{- end }} ports: - name: http containerPort: {{ .Values.httpPort }} @@ -352,4 +361,4 @@ spec: {{- end }} {{- if .Values.extraContainers }} {{ tpl .Values.extraContainers . | indent 6 }} - {{- end }} \ No newline at end of file + {{- end }} diff --git a/elasticsearch/values.yaml b/elasticsearch/values.yaml index cad0b5820..313ed6cab 100755 --- a/elasticsearch/values.yaml +++ b/elasticsearch/values.yaml @@ -1,4 +1,3 @@ ---- clusterName: "elasticsearch" nodeGroup: "master" @@ -13,8 +12,8 @@ roles: ingest: "true" data: "true" -replicas: 3 -minimumMasterNodes: 2 +replicas: 1 +minimumMasterNodes: 1 esMajorVersion: "" @@ -199,6 +198,18 @@ readinessProbe: successThreshold: 3 timeoutSeconds: 5 + customProbe: {} + # failureThreshold: 3 + # initialDelaySeconds: 10 + # periodSeconds: 10 + # successThreshold: 3 + # timeoutSeconds: 5 + # httpGet: + # path: / + # port: 8080 + + + # https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html#request-params wait_for_status clusterHealthCheckParams: "wait_for_status=green&timeout=1s" From c42b2a098234e331b7b54313230d368dead9a919 Mon Sep 17 00:00:00 2001 From: Max Schmidt Date: Fri, 14 Feb 2020 10:33:33 +0100 Subject: [PATCH 2/5] Fix README indent --- elasticsearch/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elasticsearch/README.md b/elasticsearch/README.md index 3d5202819..22774654f 100644 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -123,8 +123,8 @@ helm install --name elasticsearch elastic/elasticsearch --set imageTag=7.6.0 | `nodeAffinity` | Value for the [node affinity settings](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity-beta-feature) | `{}` | | `podManagementPolicy` | By default Kubernetes [deploys statefulsets serially](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#pod-management-policies). This deploys them in parallel so that they can discover eachother | `Parallel` | | `protocol` | The protocol that will be used for the readinessProbe. Change this to `https` if you have `xpack.security.http.ssl.enabled` set | `http` | -| `httpPort` | The http port that Kubernetes will use for the healthchecks and the service. If you change this you will also need to set [http.port](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-http.html#_settings) in `extraEnvs` | `9200` | -| `transportPort` | The transport port that Kubernetes will use for the service. If you change this you will also need to set [transport port configuration](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-transport.html#_transport_settings) in `extraEnvs` | `9300` | +| `httpPort` | The http port that Kubernetes will use for the healthchecks and the service. If you change this you will also need to set [http.port](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-http.html#_settings) in `extraEnvs` | `9200` | +| `transportPort` | The transport port that Kubernetes will use for the service. If you change this you will also need to set [transport port configuration](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-transport.html#_transport_settings) in `extraEnvs` | `9300` | | `service.labels` | Labels to be added to non-headless service | `{}` | | `service.labelsHeadless` | Labels to be added to headless service | `{}` | | `service.type` | Type of elasticsearch service. [Service Types](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types) | `ClusterIP` | From f19416adb17949355c04ca7690f616130ab594dc Mon Sep 17 00:00:00 2001 From: Max Schmidt Date: Fri, 14 Feb 2020 10:37:36 +0100 Subject: [PATCH 3/5] values.yaml whitespaces --- elasticsearch/values.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/elasticsearch/values.yaml b/elasticsearch/values.yaml index 313ed6cab..e2592bf17 100755 --- a/elasticsearch/values.yaml +++ b/elasticsearch/values.yaml @@ -208,8 +208,6 @@ readinessProbe: # path: / # port: 8080 - - # https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html#request-params wait_for_status clusterHealthCheckParams: "wait_for_status=green&timeout=1s" From bcb9ceb79770ef320a631f0f7194e714496958be Mon Sep 17 00:00:00 2001 From: Max Schmidt Date: Fri, 14 Feb 2020 10:38:27 +0100 Subject: [PATCH 4/5] revert back to default values --- elasticsearch/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elasticsearch/values.yaml b/elasticsearch/values.yaml index e2592bf17..868327e37 100755 --- a/elasticsearch/values.yaml +++ b/elasticsearch/values.yaml @@ -12,8 +12,8 @@ roles: ingest: "true" data: "true" -replicas: 1 -minimumMasterNodes: 1 +replicas: 3 +minimumMasterNodes: 2 esMajorVersion: "" From a85e970db22c05bc161bca1bfa47c7fcaa90d160 Mon Sep 17 00:00:00 2001 From: Max Schmidt Date: Mon, 17 Feb 2020 10:46:44 +0100 Subject: [PATCH 5/5] Revert back and move readinessProbe value --- elasticsearch/README.md | 3 +-- elasticsearch/templates/statefulset.yaml | 11 +---------- elasticsearch/values.yaml | 11 +---------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/elasticsearch/README.md b/elasticsearch/README.md index 22774654f..fedd45838 100644 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -140,8 +140,7 @@ helm install --name elasticsearch elastic/elasticsearch --set imageTag=7.6.0 | `terminationGracePeriod` | The [terminationGracePeriod](https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods) in seconds used when trying to stop the pod | `120` | | `sysctlInitContainer.enabled` | Allows you to disable the sysctlInitContainer if you are setting vm.max_map_count with another method | `true` | | `sysctlVmMaxMapCount` | Sets the [sysctl vm.max_map_count](https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html#vm-max-map-count) needed for Elasticsearch | `262144` | -| `readinessProbe` | Configuration fields for the [readinessProbe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/) and optional custom readinessprobe | `failureThreshold: 3`
`initialDelaySeconds: 10`
`periodSeconds: 10`
`successThreshold: 3`
`timeoutSeconds: 5` | -| `readinessProbe.custom` | Configuration fields for a custom readinessProbe to use instead of the default one | `{}` | +| `readinessProbe` | Configuration fields for the [readinessProbe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/) | `failureThreshold: 3`
`initialDelaySeconds: 10`
`periodSeconds: 10`
`successThreshold: 3`
`timeoutSeconds: 5` | | `clusterHealthCheckParams` | The [Elasticsearch cluster health status params](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html#request-params) that will be used by readinessProbe command | `wait_for_status=green&timeout=1s` | | `imagePullSecrets` | Configuration for [imagePullSecrets](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-pod-that-uses-your-secret) so that you can use a private registry for your image | `[]` | | `nodeSelector` | Configurable [nodeSelector](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) so that you can target specific nodes for your Elasticsearch cluster | `{}` | diff --git a/elasticsearch/templates/statefulset.yaml b/elasticsearch/templates/statefulset.yaml index f75fa2645..31a6cec02 100644 --- a/elasticsearch/templates/statefulset.yaml +++ b/elasticsearch/templates/statefulset.yaml @@ -191,16 +191,7 @@ spec: {{ toYaml .Values.securityContext | indent 10 }} image: "{{ .Values.image }}:{{ .Values.imageTag }}" imagePullPolicy: "{{ .Values.imagePullPolicy }}" - {{- if .Values.readinessProbe.customProbe }} readinessProbe: - {{ toYaml .Values.readinessProbe.customProbe | indent 10 | trim}} - {{- else }} - readinessProbe: - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - successThreshold: {{ .Values.readinessProbe.successThreshold }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} exec: command: - sh @@ -234,7 +225,7 @@ spec: exit 1 fi fi - {{- end }} +{{ toYaml .Values.readinessProbe | indent 10 }} ports: - name: http containerPort: {{ .Values.httpPort }} diff --git a/elasticsearch/values.yaml b/elasticsearch/values.yaml index 868327e37..cad0b5820 100755 --- a/elasticsearch/values.yaml +++ b/elasticsearch/values.yaml @@ -1,3 +1,4 @@ +--- clusterName: "elasticsearch" nodeGroup: "master" @@ -198,16 +199,6 @@ readinessProbe: successThreshold: 3 timeoutSeconds: 5 - customProbe: {} - # failureThreshold: 3 - # initialDelaySeconds: 10 - # periodSeconds: 10 - # successThreshold: 3 - # timeoutSeconds: 5 - # httpGet: - # path: / - # port: 8080 - # https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html#request-params wait_for_status clusterHealthCheckParams: "wait_for_status=green&timeout=1s"