Skip to content

Instantly share code, notes, and snippets.

@zerda
Last active October 6, 2018 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zerda/89e4c32b327bb19de5b9b78f4772e9ce to your computer and use it in GitHub Desktop.
Save zerda/89e4c32b327bb19de5b9b78f4772e9ce to your computer and use it in GitHub Desktop.
Elasticsearch 4.6 minimal cluster in Kubernetes
#
# Copyright 2017-2018 The Jaeger Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: elasticsearch
labels:
app: jaeger
jaeger-infra: elasticsearch-statefulset
spec:
serviceName: elasticsearch
replicas: 3
selector:
matchLabels:
app: jaeger-elasticsearch
jaeger-infra: elasticsearch-replica
template:
metadata:
labels:
app: jaeger-elasticsearch
jaeger-infra: elasticsearch-replica
spec:
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.1
securityContext:
runAsUser: 1000
command:
- bin/elasticsearch
args:
- "-Ediscovery.zen.ping.unicast.hosts=elasticsearch-cluster"
- "-Ediscovery.zen.minimum_master_nodes=2"
env:
- name: ES_JAVA_OPTS
# in elasticsearch, default min/max heap size is 1g,
# should be overrided with some appropriate value here
value: -Xms256m -Xmx256m
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 100m
memory: 256Mi
volumeMounts:
- name: data
mountPath: /usr/share/elasticsearch/data
ports:
- name: elasticsearch
protocol: TCP
containerPort: 9200
- name: transport
protocol: TCP
containerPort: 9300
readinessProbe:
httpGet:
path: /
port: elasticsearch
httpHeaders:
- name: Authorization
# default user/password, change it if needed
value: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==
initialDelaySeconds: 15
periodSeconds: 5
timeoutSeconds: 4
updateStrategy:
type: RollingUpdate
podManagementPolicy: Parallel
volumeClaimTemplates:
- metadata:
name: data
labels:
app: jaeger
jaeger-infra: elasticsearch-service
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 8Gi
---
apiVersion: v1
kind: Service
metadata:
name: elasticsearch
labels:
app: jaeger
jaeger-infra: elasticsearch-service
spec:
clusterIP: None
selector:
app: jaeger-elasticsearch
ports:
- name: elasticsearch
port: 9200
protocol: TCP
targetPort: 9200
---
apiVersion: v1
kind: Service
metadata:
annotations:
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
name: elasticsearch-cluster
labels:
app: jaeger
jaeger-infra: elasticsearch-service
spec:
clusterIP: None
selector:
app: jaeger-elasticsearch
ports:
- port: 9300
protocol: TCP
targetPort: 9300
publishNotReadyAddresses: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment