Created
January 20, 2023 09:54
-
-
Save Cpriyanshi77/e1df38d6e391af22b55a4ad6220b93bc to your computer and use it in GitHub Desktop.
Elasticsearch StatefulSets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: es-cluster | |
namespace: kube-logging | |
spec: | |
serviceName: elasticsearch | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: elasticsearch | |
template: | |
metadata: | |
labels: | |
app: elasticsearch | |
spec: | |
containers: | |
- name: elasticsearch | |
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0 | |
resources: | |
limits: | |
cpu: 1000m | |
memory: 2Gi | |
requests: | |
cpu: 500m | |
memory: 1Gi | |
ports: | |
- containerPort: 9200 | |
name: rest | |
protocol: TCP | |
- containerPort: 9300 | |
name: inter-node | |
protocol: TCP | |
volumeMounts: | |
- name: data | |
mountPath: /usr/share/elasticsearch/data | |
env: | |
- name: cluster.name | |
value: k8s-logs | |
- name: node.name | |
valueFrom: | |
fieldRef: | |
fieldPath: metadata.name | |
- name: discovery.seed_hosts | |
value: "es-cluster-0.elasticsearch,es-cluster-1.elasticsearch,es-cluster-2.elasticsearch" | |
- name: cluster.initial_master_nodes | |
value: "es-cluster-0,es-cluster-1,es-cluster-2" | |
- name: network.host | |
value: "0.0.0.0" | |
- name: xpack.security.enabled | |
value: "true" | |
- name: xpack.monitoring.collection.enabled | |
value: "true" | |
- name: ES_JAVA_OPTS | |
value: "-Xms512m -Xmx512m" | |
- name: ELASTIC_PASSWORD | |
valueFrom: | |
secretKeyRef: | |
name: kibana-password | |
key: password | |
initContainers: | |
- name: fix-permissions | |
image: busybox | |
command: ["sh", "-c", "chown -R 1000:1000 /usr/share/elasticsearch/data"] | |
securityContext: | |
privileged: true | |
volumeMounts: | |
- name: data | |
mountPath: /usr/share/elasticsearch/data | |
- name: increase-vm-max-map | |
image: busybox | |
command: ["sysctl", "-w", "vm.max_map_count=262144"] | |
securityContext: | |
privileged: true | |
- name: increase-fd-ulimit | |
image: busybox | |
command: ["sh", "-c", "ulimit -n 65536"] | |
securityContext: | |
privileged: true | |
volumeClaimTemplates: | |
- metadata: | |
name: data | |
labels: | |
app: elasticsearch | |
spec: | |
accessModes: [ "ReadWriteOnce" ] | |
# storageClassName: do-block-storage | |
resources: | |
requests: | |
storage: 10Gi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment