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

Commit 767a6fa

Browse files
committed
New repo structure and Manifess
Signed-off-by: Eduardo Silva <[email protected]>
1 parent 4b859d9 commit 767a6fa

8 files changed

+89
-208
lines changed

Diff for: README.md

+13-22
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,26 @@
1-
# Help to Test!
1+
# Kubernetes Logging with Fluent Bit
22

3-
[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.
3+
[Fluent Bit](http://fluentbit.io) is a lightweight and extensible __Log Processor__ that comes with full support for Kubernetes:
44

5-
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.
5+
- Read Kubernetes/Docker log files from the file system or through Systemd Journal
6+
- Enrich logs with Kubernetes metadata
7+
- Deliver logs to third party storage services like Elasticsearch, InfluxDB, HTTP, etc.
68

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

911
## Getting started
1012

11-
Fluent Bit must be deployed as a DaemonSet, on that way it will be available on every node of your Kubernetes cluster.
13+
[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:
1214

13-
This repository contains two Yaml DaemonSet files:
15+
__FIXME__
1416

15-
| Yaml file | Description |
16-
|-----------|-------------|
17-
| [fluent-bit-daemonset-elasticsearch](fluent-bit-daemonset-elasticsearch.yaml) | deploys a stable release of Fluent Bit. |
18-
19-
The current DaemonSet points to this specific Docker Hub image:
20-
21-
[0.11](https://hub.docker.com/r/fluent/fluent-bit-kubernetes-daemonset/tags/) fluent/fluent-bit-kubernetes-daemonset:0.11
22-
23-
### Steps
24-
25-
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
26-
27-
2. Deploy the daemonset file from this repository:
28-
29-
```bash
30-
$ kubectl apply -f fluent-bit-daemonset-elasticsearch.yaml
3117
```
18+
$ kubectl create namespace logging
19+
$ kubectl create -f ./fluent-bit-service-account.yaml
20+
$ kubectl create -f ./fluent-bit-role.yaml
21+
$ kubectl create -f ./fluent-bit-role-binding.yaml
3222
23+
```
3324
## Details
3425

3526
The default configuration of Fluent Bit makes sure of the following:

Diff for: fluent-bit-daemonset-configmap.yaml

-83
This file was deleted.

Diff for: fluent-bit-daemonset-elasticsearch.yaml

-59
This file was deleted.

Diff for: fluent-bit-rbac.yaml

-44
This file was deleted.

Diff for: fluent-bit-role-binding.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: rbac.authorization.k8s.io/v1beta1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: fluent-bit-read
5+
roleRef:
6+
apiGroup: rbac.authorization.k8s.io
7+
kind: ClusterRole
8+
name: fluent-bit-read
9+
subjects:
10+
- kind: ServiceAccount
11+
name: fluent-bit
12+
namespace: logging

Diff for: fluent-bit-role.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: rbac.authorization.k8s.io/v1beta1
2+
kind: ClusterRole
3+
metadata:
4+
name: fluent-bit-read
5+
rules:
6+
- apiGroups: [""]
7+
resources:
8+
- namespaces
9+
- pods
10+
verbs: ["get", "list", "watch"]

Diff for: fluent-bit-service-account.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: fluent-bit
5+
namespace: logging

Diff for: output/elasticsearch/fluent-bit-ds.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apiVersion: extensions/v1beta1
2+
kind: DaemonSet
3+
metadata:
4+
name: fluent-bit
5+
namespace: logging
6+
labels:
7+
k8s-app: fluent-bit-logging
8+
version: v1
9+
kubernetes.io/cluster-service: "true"
10+
spec:
11+
template:
12+
metadata:
13+
labels:
14+
k8s-app: fluent-bit-logging
15+
version: v1
16+
kubernetes.io/cluster-service: "true"
17+
spec:
18+
containers:
19+
- name: fluent-bit
20+
image: fluent/fluent-bit:0.12.7
21+
env:
22+
- name: FLUENT_ELASTICSEARCH_HOST
23+
value: "10.0.2.2"
24+
- name: FLUENT_ELASTICSEARCH_PORT
25+
value: "9200"
26+
volumeMounts:
27+
- name: varlog
28+
mountPath: /var/log
29+
- name: varlibdockercontainers
30+
mountPath: /var/lib/docker/containers
31+
readOnly: true
32+
- name: fluent-bit-config
33+
mountPath: /fluent-bit/etc/
34+
terminationGracePeriodSeconds: 10
35+
volumes:
36+
- name: varlog
37+
hostPath:
38+
path: /var/log
39+
- name: varlibdockercontainers
40+
hostPath:
41+
path: /var/lib/docker/containers
42+
- name: fluent-bit-config
43+
configMap:
44+
name: fluent-bit-config
45+
serviceAccountName: fluent-bit
46+
tolerations:
47+
- key: node-role.kubernetes.io/master
48+
operator: Exists
49+
effect: NoSchedule

0 commit comments

Comments
 (0)