Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contests about elastic search helm chart #150

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
1,286 changes: 1,286 additions & 0 deletions contents/Elasticsearch_Exporter/nc/v4.0.1/Elasticsearch-Exporter_review.md

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions contents/Elasticsearch_Exporter/nc/v4.0.1/helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
appVersion: 1.1.0
description: Elasticsearch stats exporter for Prometheus
home: https://github.com/justwatchcom/elasticsearch_exporter
keywords:
- metrics
- elasticsearch
- monitoring
kubeVersion: '>=1.10.0-0'
maintainers:
- email: [email protected]
name: svenmueller
- email: [email protected]
name: caarlos0
- email: [email protected]
name: desaintmartin
name: prometheus-elasticsearch-exporter
sources:
- https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus-elasticsearch-exporter
version: 4.0.1
98 changes: 98 additions & 0 deletions contents/Elasticsearch_Exporter/nc/v4.0.1/helm-chart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Elasticsearch Exporter

Prometheus exporter for various metrics about ElasticSearch, written in Go.

Learn more: <https://github.com/justwatchcom/elasticsearch_exporter>

This chart creates an Elasticsearch-Exporter deployment on a [Kubernetes](http://kubernetes.io)
cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Kubernetes 1.10+

## Get Repo Info

```console
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
```

_See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation._

## Install Chart

```console
# Helm 3
$ helm install [RELEASE_NAME] prometheus-community/prometheus-elasticsearch-exporter

# Helm 2
$ helm install --name [RELEASE_NAME] prometheus-community/prometheus-elasticsearch-exporter
```

The command deploys Elasticsearch Exporter on the Kubernetes cluster using the default configuration.

_See [configuration](#configuration) below._

_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._

## Uninstall Chart

```console
# Helm 3
$ helm uninstall [RELEASE_NAME]

# Helm 2
# helm delete --purge [RELEASE_NAME]
```

This removes all the Kubernetes components associated with the chart and deletes the release.

_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._

## Upgrading Chart

```console
# Helm 3 or 2
$ helm upgrade [RELEASE_NAME] [CHART] --install
```

_See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._

### To 4.0.0

While migrating the chart from `stable/elasticsearch-exporter` it was renamed to `prometheus-elasticsearch-exporter`.
If you want to upgrade from a previous version and you need to keep the old resource names (`Service`, `Deployment`, etc) you can set `fullnameOverride` and `nameOverride` to do so.

The example below shows how those values should be set for a `my-exporter` release of the previous chart.

```console
helm install my-exporter stable/elasticsearch-exporter
helm upgrade my-exporter . --set fullnameOverride=my-exporter-elasticsearch-exporter --set nameOverride=elasticsearch-exporter
```

### To 3.0.0

`prometheusRule.rules` are now processed as Helm template, allowing to set variables in them.
This means that if a rule contains a {{ $value }}, Helm will try replacing it and probably fail.

You now need to escape the rules (see `values.yaml`) for examples.

### To 2.0.0

Some Kubernetes apis used from 1.x have been deprecated. You need to update your cluster to Kubernetes 1.10+ to support new definitions used in 2.x.

## Configuration

See [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing).
To see all configurable options with detailed comments, visit the chart's [values.yaml](./values.yaml), or run these configuration commands:

```console
# Helm 2
$ helm inspect values prometheus-community/prometheus-elasticsearch-exporter

# Helm 3
$ helm show values prometheus-community/prometheus-elasticsearch-exporter
```

> **Tip**: You can use the default [values.yaml](values.yaml)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Leave this file empty to ensure that CI runs builds against the default configuration in values.yaml.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
# Set default security context for kubernetes

securityContext:
disable: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "elasticsearch-exporter.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT{{ .Values.web.path }}
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "elasticsearch-exporter.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "elasticsearch-exporter.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.httpPort }}{{ .Values.web.path }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "elasticsearch-exporter.fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:{{ .Values.service.httpPort }}{{ .Values.web.path }} to use your application"
kubectl port-forward $POD_NAME {{ .Values.service.httpPort }}:{{ .Values.service.httpPort }} --namespace {{ .Release.Namespace }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "elasticsearch-exporter.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "elasticsearch-exporter.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "elasticsearch-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if and .Values.es.ssl.enabled (eq .Values.es.ssl.useExistingSecrets false) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "elasticsearch-exporter.fullname" . }}-cert
labels:
chart: {{ template "elasticsearch-exporter.chart" . }}
app: {{ template "elasticsearch-exporter.name" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
type: Opaque
data:
ca.pem: {{ .Values.es.ssl.ca.pem | b64enc }}
client.pem: {{ .Values.es.ssl.client.pem | b64enc }}
client.key: {{ .Values.es.ssl.client.key | b64enc }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "elasticsearch-exporter.fullname" . }}
labels:
chart: {{ template "elasticsearch-exporter.chart" . }}
app: {{ template "elasticsearch-exporter.name" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "elasticsearch-exporter.name" . }}
release: "{{ .Release.Name }}"
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
app: {{ template "elasticsearch-exporter.name" . }}
release: "{{ .Release.Name }}"
{{- if .Values.podAnnotations }}
annotations:
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
spec:
{{- if .Values.serviceAccount.create }}
serviceAccountName: {{ template "elasticsearch-exporter.fullname" . }}
{{- else }}
serviceAccountName: {{ .Values.serviceAccount.name }}
{{- end }}
{{- if .Values.priorityClassName }}
priorityClassName: "{{ .Values.priorityClassName }}"
{{- end }}
{{- if .Values.image.pullSecret }}
imagePullSecrets:
- name: {{ .Values.image.pullSecret }}
{{- end }}
restartPolicy: {{ .Values.restartPolicy }}
{{- if .Values.securityContext.enabled }}
securityContext:
runAsNonRoot: true
runAsUser: {{ .Values.securityContext.runAsUser }}
{{- end }}
containers:
- name: exporter
env:
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: "{{ $value }}"
{{- end }}
{{- range $key, $value := .Values.extraEnvSecrets }}
- name: {{ $key }}
valueFrom:
secretKeyRef:
name: {{ required "Must specify secret!" $value.secret }}
key: {{ required "Must specify key!" $value.key }}
{{- end }}
{{- if .Values.envFromSecret }}
envFrom:
- secretRef:
name: {{ .Values.envFromSecret }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["elasticsearch_exporter",
{{- with .Values.log.format }}
"--log.format={{ . }}",
{{- end }}
{{- with .Values.log.level }}
"--log.level={{ . }}",
{{- end }}
{{- if .Values.es.uri }}
"--es.uri={{ .Values.es.uri }}",
{{- end }}
{{- if .Values.es.all }}
"--es.all",
{{- end }}
{{- if .Values.es.indices }}
"--es.indices",
{{- end }}
{{- if .Values.es.indices_settings }}
"--es.indices_settings",
{{- end }}
{{- if .Values.es.shards }}
"--es.shards",
{{- end }}
{{- if .Values.es.snapshots }}
"--es.snapshots",
{{- end }}
{{- if .Values.es.cluster_settings }}
"--es.cluster_settings",
{{- end }}
"--es.timeout={{ .Values.es.timeout }}",
{{- if .Values.es.sslSkipVerify }}
"--es.ssl-skip-verify",
{{- end }}
{{- if .Values.es.ssl.enabled }}
"--es.ca={{.Values.es.ssl.ca.path }}",
{{- if .Values.es.ssl.client.enabled }}
"--es.client-cert={{ .Values.es.ssl.client.pemPath }}",
"--es.client-private-key={{ .Values.es.ssl.client.keyPath }}",
{{- end }}
{{- end }}
"--web.listen-address=:{{ .Values.service.httpPort }}",
"--web.telemetry-path={{ .Values.web.path }}"]
securityContext:
capabilities:
drop:
- SETPCAP
- MKNOD
- AUDIT_WRITE
- CHOWN
- NET_RAW
- DAC_OVERRIDE
- FOWNER
- FSETID
- KILL
- SETGID
- SETUID
- NET_BIND_SERVICE
- SYS_CHROOT
- SETFCAP
readOnlyRootFilesystem: true
resources:
{{ toYaml .Values.resources | indent 12 }}
ports:
- containerPort: {{ .Values.service.httpPort }}
name: http
livenessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 5
timeoutSeconds: 5
periodSeconds: 5
readinessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 1
timeoutSeconds: 5
periodSeconds: 5
lifecycle:
preStop:
exec:
command: ["/bin/bash", "-c", "sleep 20"]
volumeMounts:
{{- if and .Values.es.ssl.enabled (eq .Values.es.ssl.useExistingSecrets false) }}
- mountPath: /ssl
name: ssl
{{- end }}
{{- range .Values.secretMounts }}
- name: {{ .name }}
mountPath: {{ .path }}
{{- if .subPath }}
subPath: {{ .subPath }}
{{- end }}
{{- end }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
{{- if .Values.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{- end }}
volumes:
{{- if and .Values.es.ssl.enabled (eq .Values.es.ssl.useExistingSecrets false) }}
- name: ssl
secret:
secretName: {{ template "elasticsearch-exporter.fullname" . }}-cert
{{- end }}
{{- range .Values.secretMounts }}
- name: {{ .name }}
secret:
secretName: {{ .secretName }}
{{- end }}
Loading