Skip to content

Instantly share code, notes, and snippets.

@puttpotsawee
Last active September 7, 2018 10:17
Show Gist options
  • Save puttpotsawee/34a5d5b0b0d08aff9a104e17ddc7bb31 to your computer and use it in GitHub Desktop.
Save puttpotsawee/34a5d5b0b0d08aff9a104e17ddc7bb31 to your computer and use it in GitHub Desktop.
elasticsearch 2 with backup
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: logging-elastic
spec:
replicas: 1
serviceName: logging-elastic
template:
metadata:
labels:
app: logging-elastic
spec:
terminationGracePeriodSeconds: 10
containers:
- name: logging-elastic
image: elasticsearch:2-alpine
ports:
- containerPort: 9200
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: logging-elastic-data
- mountPath: /mount/backups
name: logging-elastic-backup
- name: logging-elastic-config
mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
subPath: elasticsearch.yml
volumes:
- name: logging-elastic-data
persistentVolumeClaim:
claimName: elastic-logger
- name: logging-elastic-backup
persistentVolumeClaim:
claimName: elastic-logger-backup
- name: logging-elastic-config
configMap:
name: logging-elastic-config
---
apiVersion: v1
kind: ConfigMap
metadata:
name: logging-elastic-config
data:
'elasticsearch.yml': |
network.host: 0.0.0.0
path.repo: ["/mount/backups"]
---
apiVersion: v1
kind: Service
metadata:
name: logging-elastic-service
labels:
name: logging-elastic-service
spec:
clusterIP: None
ports:
- name: logging-elastic-port
port: 9200
targetPort: 9200
protocol: TCP
selector:
app: logging-elastic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment