├── Readme.md ├── counter.yaml ├── fluentd-daemonset-elasticsearch.yaml ├── images ├── efk-lightboard.jpg ├── efk-sketch-light.jpg └── efk-sketch.jpg └── kibana-values.yaml /Readme.md: -------------------------------------------------------------------------------- 1 | # Logging with EFK in Kubernetes 2 | 3 | This workshop shows how to install the EFK (Elasticsearch, Fluentd and Kibana) stack in Kubernetes using Helm, to get application logs. 4 | 5 | The workshop is available as a video on youtube: 6 | 7 | 8 | 9 | And these are the amin commands used to install EFK: 10 | 11 | $ helm install elasticsearch stable/elasticsearch 12 | wait for few minutes.. 13 | 14 | $ kubectl apply -f .\fluentd-daemonset-elasticsearch.yaml 15 | 16 | $ helm install kibana stable/kibana -f kibana-values.yaml 17 | 18 | $ kubectl apply -f .\counter.yaml 19 | 20 | Open Kibana dashboard. -------------------------------------------------------------------------------- /counter.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: counter 5 | spec: 6 | containers: 7 | - name: count 8 | image: busybox 9 | args: [/bin/sh, -c, 'i=0; while true; do echo "This is demo log $i: $(date)"; i=$((i+1)); sleep 1; done'] -------------------------------------------------------------------------------- /fluentd-daemonset-elasticsearch.yaml: -------------------------------------------------------------------------------- 1 | # src: https://github.com/fluent/fluentd-kubernetes-daemonset/blob/master/fluentd-daemonset-elasticsearch.yaml 2 | apiVersion: apps/v1 3 | kind: DaemonSet 4 | metadata: 5 | name: fluentd 6 | # namespace: kube-system 7 | labels: 8 | k8s-app: fluentd-logging 9 | version: v1 10 | spec: 11 | selector: 12 | matchLabels: 13 | k8s-app: fluentd-logging 14 | version: v1 15 | template: 16 | metadata: 17 | labels: 18 | k8s-app: fluentd-logging 19 | version: v1 20 | spec: 21 | tolerations: 22 | - key: node-role.kubernetes.io/master 23 | effect: NoSchedule 24 | containers: 25 | - name: fluentd 26 | image: fluent/fluentd-kubernetes-daemonset:v1-debian-elasticsearch 27 | env: 28 | - name: FLUENT_ELASTICSEARCH_HOST 29 | value: "elasticsearch-client" 30 | - name: FLUENT_ELASTICSEARCH_PORT 31 | value: "9200" 32 | - name: FLUENT_ELASTICSEARCH_SCHEME 33 | value: "http" 34 | # Option to configure elasticsearch plugin with self signed certs 35 | # ================================================================ 36 | - name: FLUENT_ELASTICSEARCH_SSL_VERIFY 37 | value: "false" # changed by me 38 | # Option to configure elasticsearch plugin with tls 39 | # ================================================================ 40 | - name: FLUENT_ELASTICSEARCH_SSL_VERSION 41 | value: "TLSv1_2" 42 | # X-Pack Authentication 43 | # ===================== 44 | - name: FLUENT_ELASTICSEARCH_USER 45 | value: "elastic" 46 | - name: FLUENT_ELASTICSEARCH_PASSWORD 47 | value: "changeme" 48 | # Logz.io Authentication 49 | # ====================== 50 | - name: LOGZIO_TOKEN 51 | value: "ThisIsASuperLongToken" 52 | - name: LOGZIO_LOGTYPE 53 | value: "kubernetes" 54 | resources: 55 | limits: 56 | memory: 200Mi 57 | requests: 58 | cpu: 100m 59 | memory: 200Mi 60 | volumeMounts: 61 | - name: varlog 62 | mountPath: /var/log 63 | - name: varlibdockercontainers 64 | mountPath: /var/lib/docker/containers 65 | readOnly: true 66 | terminationGracePeriodSeconds: 30 67 | volumes: 68 | - name: varlog 69 | hostPath: 70 | path: /var/log 71 | - name: varlibdockercontainers 72 | hostPath: 73 | path: /var/lib/docker/containers -------------------------------------------------------------------------------- /images/efk-lightboard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HoussemDellai/EFK-Kubernetes/b49fd8a24013e20be68eac958fb9b0ceaa20b779/images/efk-lightboard.jpg -------------------------------------------------------------------------------- /images/efk-sketch-light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HoussemDellai/EFK-Kubernetes/b49fd8a24013e20be68eac958fb9b0ceaa20b779/images/efk-sketch-light.jpg -------------------------------------------------------------------------------- /images/efk-sketch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HoussemDellai/EFK-Kubernetes/b49fd8a24013e20be68eac958fb9b0ceaa20b779/images/efk-sketch.jpg -------------------------------------------------------------------------------- /kibana-values.yaml: -------------------------------------------------------------------------------- 1 | files: 2 | kibana.yml: 3 | ## Default Kibana configuration from kibana-docker. 4 | server.name: kibana 5 | server.host: "0" 6 | ## For kibana < 6.6, use elasticsearch.url instead 7 | elasticsearch.hosts: http://elasticsearch-client:9200 8 | 9 | service: 10 | type: LoadBalancer # ClusterIP 11 | --------------------------------------------------------------------------------