Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
New repo structure and Manifess
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Silva <[email protected]>
  • Loading branch information
edsiper committed Nov 3, 2017
1 parent 4b859d9 commit 767a6fa
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 208 deletions.
35 changes: 13 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
# Help to Test!
# Kubernetes Logging with Fluent Bit

[Fluent Bit](http://fluentbit.io) v0.11 was just released at the end of March 2017 and it comes with support for Kubernetes logging needs: it can consume logs and enrich them with proper Kubernetes metadata, retrieved from the API server of course.
[Fluent Bit](http://fluentbit.io) is a lightweight and extensible __Log Processor__ that comes with full support for Kubernetes:

Our goal is to make logging cheaper in terms of memory consumption. In order to accomplish this we need to deal with different factors, not only processing incoming logs but also _formatting_ the data for our backends like Elasticsearch, which can be a little expensive as it requires a JSON representation.
- Read Kubernetes/Docker log files from the file system or through Systemd Journal
- Enrich logs with Kubernetes metadata
- Deliver logs to third party storage services like Elasticsearch, InfluxDB, HTTP, etc.

> Note: Fluent Bit uses a binary representation for logs, converting this to JSON requires enough memory for the process.
This repository contains a set of Yaml files to deploy Fluent Bit which consider namespace, RBAC, Service Account, etc.

## Getting started

Fluent Bit must be deployed as a DaemonSet, on that way it will be available on every node of your Kubernetes cluster.
[Fluent Bit](http://fluentbit.io) must be deployed as a DaemonSet, so on that way it will be available on every node of your Kubernetes cluster. To get started:

This repository contains two Yaml DaemonSet files:
__FIXME__

| Yaml file | Description |
|-----------|-------------|
| [fluent-bit-daemonset-elasticsearch](fluent-bit-daemonset-elasticsearch.yaml) | deploys a stable release of Fluent Bit. |

The current DaemonSet points to this specific Docker Hub image:

[0.11](https://hub.docker.com/r/fluent/fluent-bit-kubernetes-daemonset/tags/) fluent/fluent-bit-kubernetes-daemonset:0.11

### Steps

1. Make sure your Elasticsearch backend is running and can be reach through the hostname _elasticsearch-logging_. This value can be changed in the Yaml file

2. Deploy the daemonset file from this repository:

```bash
$ kubectl apply -f fluent-bit-daemonset-elasticsearch.yaml
```
$ kubectl create namespace logging
$ kubectl create -f ./fluent-bit-service-account.yaml
$ kubectl create -f ./fluent-bit-role.yaml
$ kubectl create -f ./fluent-bit-role-binding.yaml
```
## Details

The default configuration of Fluent Bit makes sure of the following:
Expand Down
83 changes: 0 additions & 83 deletions fluent-bit-daemonset-configmap.yaml

This file was deleted.

59 changes: 0 additions & 59 deletions fluent-bit-daemonset-elasticsearch.yaml

This file was deleted.

44 changes: 0 additions & 44 deletions fluent-bit-rbac.yaml

This file was deleted.

12 changes: 12 additions & 0 deletions fluent-bit-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: fluent-bit-read
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: fluent-bit-read
subjects:
- kind: ServiceAccount
name: fluent-bit
namespace: logging
10 changes: 10 additions & 0 deletions fluent-bit-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: fluent-bit-read
rules:
- apiGroups: [""]
resources:
- namespaces
- pods
verbs: ["get", "list", "watch"]
5 changes: 5 additions & 0 deletions fluent-bit-service-account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: fluent-bit
namespace: logging
49 changes: 49 additions & 0 deletions output/elasticsearch/fluent-bit-ds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: fluent-bit
namespace: logging
labels:
k8s-app: fluent-bit-logging
version: v1
kubernetes.io/cluster-service: "true"
spec:
template:
metadata:
labels:
k8s-app: fluent-bit-logging
version: v1
kubernetes.io/cluster-service: "true"
spec:
containers:
- name: fluent-bit
image: fluent/fluent-bit:0.12.7
env:
- name: FLUENT_ELASTICSEARCH_HOST
value: "10.0.2.2"
- name: FLUENT_ELASTICSEARCH_PORT
value: "9200"
volumeMounts:
- name: varlog
mountPath: /var/log
- name: varlibdockercontainers
mountPath: /var/lib/docker/containers
readOnly: true
- name: fluent-bit-config
mountPath: /fluent-bit/etc/
terminationGracePeriodSeconds: 10
volumes:
- name: varlog
hostPath:
path: /var/log
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers
- name: fluent-bit-config
configMap:
name: fluent-bit-config
serviceAccountName: fluent-bit
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule

0 comments on commit 767a6fa

Please sign in to comment.