mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-04 09:58:20 +03:00
Adding EFK logging stack
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
elasticsearch_cpu_limit: 1000m
|
||||
elasticsearch_mem_limit: 0M
|
||||
elasticsearch_cpu_requests: 100m
|
||||
elasticsearch_mem_requests: 0M
|
||||
elasticsearch_service_port: 9200
|
||||
7
roles/kubernetes-apps/efk/elasticsearch/meta/main.yml
Normal file
7
roles/kubernetes-apps/efk/elasticsearch/meta/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
dependencies:
|
||||
- role: download
|
||||
file: "{{ downloads.elasticsearch }}"
|
||||
# TODO: bradbeam add in curator
|
||||
# https://github.com/Skillshare/kubernetes-efk/blob/master/configs/elasticsearch.yml#L94
|
||||
# - role: download
|
||||
# file: "{{ downloads.curator }}"
|
||||
35
roles/kubernetes-apps/efk/elasticsearch/tasks/main.yml
Normal file
35
roles/kubernetes-apps/efk/elasticsearch/tasks/main.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
- name: "ElasticSearch | Write ES deployment"
|
||||
template:
|
||||
src: elasticsearch-deployment.yml.j2
|
||||
dest: "{{ kube_config_dir }}/elasticsearch-deployment.yaml"
|
||||
register: es_deployment_manifest
|
||||
|
||||
- name: "ElasticSearch | Create ES deployment"
|
||||
kube:
|
||||
filename: "{{kube_config_dir}}/elasticsearch-deployment.yaml"
|
||||
kubectl: "{{bin_dir}}/kubectl"
|
||||
name: "elasticsearch-logging-v1"
|
||||
namespace: "{{system_namespace}}"
|
||||
resource: "rc"
|
||||
state: "{{ item | ternary('latest','present') }}"
|
||||
#state: "latest"
|
||||
with_items: "{{ es_deployment_manifest.changed }}"
|
||||
run_once: true
|
||||
|
||||
- name: "ElasticSearch | Write ES service "
|
||||
template:
|
||||
src: elasticsearch-service.yml.j2
|
||||
dest: "{{ kube_config_dir }}/elasticsearch-service.yaml"
|
||||
register: es_service_manifest
|
||||
|
||||
- name: "ElasticSearch | Create ES service"
|
||||
kube:
|
||||
filename: "{{kube_config_dir}}/elasticsearch-service.yaml"
|
||||
kubectl: "{{bin_dir}}/kubectl"
|
||||
name: "elasticsearch-logging"
|
||||
namespace: "{{system_namespace}}"
|
||||
resource: "svc"
|
||||
state: "{{ item | ternary('latest','present') }}"
|
||||
with_items: "{{ es_service_manifest.changed }}"
|
||||
run_once: true
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
# https://raw.githubusercontent.com/kubernetes/kubernetes/v1.5.2/cluster/addons/fluentd-elasticsearch/es-controller.yaml
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: elasticsearch-logging-v1
|
||||
namespace: "{{ system_namespace }}"
|
||||
labels:
|
||||
k8s-app: elasticsearch-logging
|
||||
version: "{{ elasticsearch_image_tag }}"
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
k8s-app: elasticsearch-logging
|
||||
version: "{{ elasticsearch_image_tag }}"
|
||||
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" %}
|
||||
mem: {{ elasticsearch_mem_limit }}
|
||||
{% endif %}
|
||||
requests:
|
||||
cpu: {{ elasticsearch_cpu_requests }}
|
||||
{% if elasticsearch_mem_requests is defined and elasticsearch_mem_requests != "0M" %}
|
||||
mem: {{ elasticsearch_mem_requests }}
|
||||
{% 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: {}
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: elasticsearch-logging
|
||||
namespace: "{{ system_namespace }}"
|
||||
labels:
|
||||
k8s-app: elasticsearch-logging
|
||||
kubernetes.io/cluster-service: "true"
|
||||
kubernetes.io/name: "Elasticsearch"
|
||||
spec:
|
||||
ports:
|
||||
- port: {{ elasticsearch_service_port }}
|
||||
protocol: TCP
|
||||
targetPort: db
|
||||
selector:
|
||||
k8s-app: elasticsearch-logging
|
||||
|
||||
Reference in New Issue
Block a user