2017-01-27 07:33:01 +08:00
|
|
|
---
|
2018-05-12 00:22:44 +08:00
|
|
|
# https://raw.githubusercontent.com/kubernetes/kubernetes/v1.10.2/cluster/addons/fluentd-elasticsearch/es-statefulset.yaml
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: StatefulSet
|
2017-01-27 07:33:01 +08:00
|
|
|
metadata:
|
2018-05-12 00:22:44 +08:00
|
|
|
name: elasticsearch-logging
|
2018-03-30 19:29:13 +08:00
|
|
|
namespace: kube-system
|
2017-01-27 07:33:01 +08:00
|
|
|
labels:
|
|
|
|
k8s-app: elasticsearch-logging
|
|
|
|
version: "{{ elasticsearch_image_tag }}"
|
|
|
|
kubernetes.io/cluster-service: "true"
|
2018-05-12 00:22:44 +08:00
|
|
|
addonmanager.kubernetes.io/mode: Reconcile
|
2017-01-27 07:33:01 +08:00
|
|
|
spec:
|
2018-05-13 20:23:37 +08:00
|
|
|
serviceName: elasticsearch-logging
|
2017-01-27 07:33:01 +08:00
|
|
|
replicas: 2
|
|
|
|
selector:
|
2017-08-10 14:48:53 +08:00
|
|
|
matchLabels:
|
|
|
|
k8s-app: elasticsearch-logging
|
|
|
|
version: "{{ elasticsearch_image_tag }}"
|
2017-01-27 07:33:01 +08:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
k8s-app: elasticsearch-logging
|
|
|
|
version: "{{ elasticsearch_image_tag }}"
|
|
|
|
kubernetes.io/cluster-service: "true"
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- image: "{{ elasticsearch_image_repo }}:{{ elasticsearch_image_tag }}"
|
|
|
|
name: elasticsearch-logging
|
|
|
|
resources:
|
|
|
|
# need more cpu upon initialization, therefore burstable class
|
|
|
|
limits:
|
|
|
|
cpu: {{ elasticsearch_cpu_limit }}
|
|
|
|
{% if elasticsearch_mem_limit is defined and elasticsearch_mem_limit != "0M" %}
|
2018-04-12 17:41:36 +08:00
|
|
|
memory: "{{ elasticsearch_mem_limit }}"
|
2017-01-27 07:33:01 +08:00
|
|
|
{% endif %}
|
|
|
|
requests:
|
|
|
|
cpu: {{ elasticsearch_cpu_requests }}
|
|
|
|
{% if elasticsearch_mem_requests is defined and elasticsearch_mem_requests != "0M" %}
|
2018-04-12 17:41:36 +08:00
|
|
|
memory: "{{ elasticsearch_mem_requests }}"
|
2017-01-27 07:33:01 +08:00
|
|
|
{% endif %}
|
|
|
|
ports:
|
|
|
|
- containerPort: 9200
|
|
|
|
name: db
|
|
|
|
protocol: TCP
|
|
|
|
- containerPort: 9300
|
|
|
|
name: transport
|
|
|
|
protocol: TCP
|
|
|
|
volumeMounts:
|
|
|
|
- name: es-persistent-storage
|
|
|
|
mountPath: /data
|
|
|
|
volumes:
|
|
|
|
- name: es-persistent-storage
|
|
|
|
emptyDir: {}
|
2017-08-10 14:48:53 +08:00
|
|
|
{% if rbac_enabled %}
|
|
|
|
serviceAccountName: efk
|
|
|
|
{% endif %}
|
2018-05-12 00:22:44 +08:00
|
|
|
initContainers:
|
|
|
|
- image: alpine:3.6
|
|
|
|
command: ["/sbin/sysctl", "-w", "vm.max_map_count=262144"]
|
|
|
|
name: elasticsearch-logging-init
|
|
|
|
securityContext:
|
|
|
|
privileged: true
|
2017-08-10 14:48:53 +08:00
|
|
|
|