Skip to content

Commit d7bac99

Browse files
committed
Adding Elasticsearch helm chart.
1 parent 1945b2c commit d7bac99

12 files changed

Lines changed: 546 additions & 0 deletions

elasticsearch/.helmignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

elasticsearch/Chart.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2017 The Openstack-Helm Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
description: A Helm chart for Elasticsearch
17+
name: elasticsearch
18+
version: 0.1.0
19+
maintainers:
20+
- name: OpenStack-Helm Authors

elasticsearch/README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Elasticsearch Helm Chart
2+
3+
This chart installs a working version of Elasticsearch cluster on Kubernetes.
4+
5+
### Installation
6+
7+
Values.yaml contains configuration for Elasticsearch cluster.
8+
9+
#### Note: Minimum of 2 Master Nodes are required for elasticsearch cluster
10+
11+
```
12+
helm install elasticsearch
13+
14+
```
15+
### To verify the helm deployment was successful:
16+
17+
```
18+
helm list
19+
```
20+
21+
### To confirm all pods are up and running:
22+
23+
```
24+
kubectl get pods
25+
26+
```
27+
28+
### To view list of services
29+
30+
```
31+
kubectl get svc
32+
```
33+
34+
```
35+
elasticsearch-discovery 10.99.148.252 <none> 9300/TCP 47m
36+
elasticsearch-logging 10.105.222.126 <pending> 9200:31070/TCP 47m
37+
```
38+
39+
### Test elasticsearch functionality:
40+
41+
#### From any host within cluster..
42+
43+
1) Check if Elasticsearch cluster is up
44+
```
45+
curl http://10.105.222.126:9200
46+
```
47+
```
48+
curl http://10.105.222.126:9200/_cluster/health?pretty
49+
```
50+
51+
2) Store data manually using APIs
52+
```
53+
curl -XPUT 'http://10.105.222.126:9200/blog/user/renmak' -d \
54+
'{ "name" : "Dilbert Brown" }'
55+
```
56+
```
57+
curl -XPUT 'http://10.105.222.126:9200/blog/post/1' -d \
58+
'{ "user":"renmak", "title":"how to test ES"}'
59+
```
60+
3) Retrive data manually using APIs
61+
```
62+
curl -XGET 'http://10.105.222.126:9200/blog/user/renmak?pretty=true'
63+
64+
curl -XGET 'http://10.105.222.126:9200/blog/post/1?pretty=true'
65+
66+
curl -XGET 'http://10.105.222.126:9200/blog/post/_search?q=user:renmak&pretty=true'
67+
68+
curl -XGET 'http://10.105.222.126:9200/_search?q=*renmak&pretty=true'
69+
70+
```
71+

elasticsearch/templates/.DS_Store

6 KB
Binary file not shown.

elasticsearch/templates/NOTES.txt

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 24 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
*/}}
13+
{{- define "fullname" -}}
14+
{{- $name := default .Chart.Name .Values.nameOverride -}}
15+
{{- printf "%s-%s" .Release.Name $name | trunc 24 | trimSuffix "-" -}}
16+
{{- end -}}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Copyright 2017 The Openstack-Helm Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: extensions/v1beta1
16+
kind: Deployment
17+
metadata:
18+
name: {{ .Values.labels.es_client.name }}
19+
labels:
20+
component: {{ .Values.labels.common.component }}
21+
role: {{ .Values.labels.es_client.role }}
22+
spec:
23+
replicas: {{ .Values.replicas.es_client }}
24+
template:
25+
metadata:
26+
labels:
27+
component: {{ .Values.labels.common.component }}
28+
role: {{ .Values.labels.es_client.role }}
29+
annotations:
30+
# Elasticsearch uses a hybrid mmapfs / niofs directory by default to
31+
# store its indices. The default operating system limits on mmap counts
32+
# is likely to be too low, which may result in out of memory exceptions,
33+
# so we use vm.max_map_count=262144 to increase that value.
34+
pod.beta.kubernetes.io/init-containers: '[
35+
{
36+
"name": "sysctl",
37+
"image": "busybox",
38+
"imagePullPolicy": "IfNotPresent",
39+
"command": ["sysctl", "-w", "vm.max_map_count=262144"],
40+
"securityContext": {
41+
"privileged": true
42+
}
43+
}
44+
]'
45+
spec:
46+
containers:
47+
- name: {{ .Values.labels.es_client.name }}
48+
securityContext:
49+
privileged: false
50+
capabilities:
51+
add:
52+
- IPC_LOCK
53+
- SYS_RESOURCE
54+
image: {{ .Values.images.elasticsearch }}
55+
imagePullPolicy: {{ .Values.images.pullPolicy }}
56+
{{- if .Values.resources.enabled }}
57+
resources:
58+
limits:
59+
cpu: {{ .Values.resources.limits.cpu }}
60+
memory: {{ .Values.resources.limits.memory }}
61+
requests:
62+
cpu: {{ .Values.resources.requests.cpu }}
63+
memory: {{ .Values.resources.requests.memory }}
64+
{{- end }}
65+
env:
66+
- name: NAMESPACE
67+
valueFrom:
68+
fieldRef:
69+
fieldPath: metadata.namespace
70+
- name: NODE_NAME
71+
valueFrom:
72+
fieldRef:
73+
fieldPath: metadata.name
74+
- name: "CLUSTER_NAME"
75+
value: {{ .Values.cluster_name }}
76+
- name: NODE_MASTER
77+
value: "false"
78+
- name: NODE_DATA
79+
value: "false"
80+
- name: HTTP_ENABLE
81+
value: "true"
82+
- name: "ES_JAVA_OPTS"
83+
value: {{ .Values.es_java_opts.es_client }}
84+
ports:
85+
- containerPort: {{ .Values.network.client.port }}
86+
name: {{ .Values.network.client.name }}
87+
protocol: {{ .Values.network.client.protocol }}
88+
- containerPort: {{ .Values.network.discovery.port}}
89+
name: {{ .Values.network.discovery.name }}
90+
protocol: {{ .Values.network.discovery.protocol }}
91+
volumeMounts:
92+
- name: storage
93+
mountPath: /data
94+
volumes:
95+
- name: storage
96+
emptyDir: {}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Copyright 2017 The Openstack-Helm Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: extensions/v1beta1
16+
kind: Deployment
17+
metadata:
18+
name: {{ .Values.labels.es_data.name }}
19+
labels:
20+
component: {{ .Values.labels.common.component }}
21+
role: {{ .Values.labels.es_data.role }}
22+
spec:
23+
replicas: {{ .Values.replicas.es_data }}
24+
template:
25+
metadata:
26+
labels:
27+
component: {{ .Values.labels.common.component }}
28+
role: {{ .Values.labels.es_data.role }}
29+
annotations:
30+
pod.beta.kubernetes.io/init-containers: '[
31+
{
32+
"name": "sysctl",
33+
"image": "busybox",
34+
"imagePullPolicy": "IfNotPresent",
35+
"command": ["sysctl", "-w", "vm.max_map_count=262144"],
36+
"securityContext": {
37+
"privileged": true
38+
}
39+
}
40+
]'
41+
spec:
42+
containers:
43+
- name: {{ .Values.labels.es_data.name }}
44+
securityContext:
45+
privileged: false
46+
capabilities:
47+
add:
48+
- IPC_LOCK
49+
- SYS_RESOURCE
50+
image: {{ .Values.images.elasticsearch }}
51+
imagePullPolicy: {{ .Values.images.pullPolicy }}
52+
{{- if .Values.resources.enabled }}
53+
resources:
54+
limits:
55+
cpu: {{ .Values.resources.limits.cpu }}
56+
memory: {{ .Values.resources.limits.memory }}
57+
requests:
58+
cpu: {{ .Values.resources.requests.cpu }}
59+
memory: {{ .Values.resources.requests.memory }}
60+
{{- end }}
61+
env:
62+
- name: NAMESPACE
63+
valueFrom:
64+
fieldRef:
65+
fieldPath: metadata.namespace
66+
- name: NODE_NAME
67+
valueFrom:
68+
fieldRef:
69+
fieldPath: metadata.name
70+
- name: "CLUSTER_NAME"
71+
value: {{ .Values.cluster_name }}
72+
- name: NODE_MASTER
73+
value: "false"
74+
- name: NODE_INGEST
75+
value: "false"
76+
- name: HTTP_ENABLE
77+
value: "false"
78+
- name: "ES_JAVA_OPTS"
79+
value: {{ .Values.es_java_opts.es_data }}
80+
ports:
81+
- containerPort: {{ .Values.network.discovery.port}}
82+
name: {{ .Values.network.discovery.name}}
83+
protocol: {{ .Values.network.discovery.protocol}}
84+
volumeMounts:
85+
- name: storage
86+
mountPath: /data
87+
volumes:
88+
- name: storage
89+
emptyDir: {}

0 commit comments

Comments
 (0)