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

Commit

Permalink
Merge pull request #8 from Globegitter/some-updates
Browse files Browse the repository at this point in the history
Pull out config files. Add rbac and other minor updates.
  • Loading branch information
edsiper authored Nov 2, 2017
2 parents 8674b32 + 5172444 commit 6136860
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 77 deletions.
5 changes: 1 addition & 4 deletions docker-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
FROM fluent/fluent-bit:0.11.17
FROM fluent/fluent-bit:0.12.1
MAINTAINER Eduardo Silva <[email protected]>
USER root

COPY fluent-bit.conf /fluent-bit/etc/
COPY parsers.conf /fluent-bit/etc/

CMD ["/fluent-bit/bin/fluent-bit", "-c", "/fluent-bit/etc/fluent-bit.conf"]
27 changes: 0 additions & 27 deletions docker-image/fluent-bit.conf

This file was deleted.

45 changes: 0 additions & 45 deletions docker-image/parsers.conf

This file was deleted.

83 changes: 83 additions & 0 deletions fluent-bit-daemonset-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: fluent-bit-config-v1
namespace: kube-system
data:
fluent-bit.conf: |
[SERVICE]
Flush 1
Daemon Off
Log_Level info
Parsers_File parsers.conf
[INPUT]
Name tail
Tag kubernetes.*
Path /var/log/containers/*.log
Parser docker
DB /var/log/flb_kube.db
Mem_Buf_Limit 5MB
[FILTER]
Name kubernetes
Match kubernetes.*
Kube_URL https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}
tls.verify False
Merge_JSON_Log On
[OUTPUT]
Name es
Match *
Host ${FLUENT_ELASTICSEARCH_HOST}
Port ${FLUENT_ELASTICSEARCH_PORT}
Logstash_Format On
Retry_Limit False
parsers.conf: |
[PARSER]
Name apache
Format regex
Regex ^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
Time_Key time
Time_Format %d/%b/%Y:%H:%M:%S %z
[PARSER]
Name apache2
Format regex
Regex ^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
Time_Key time
Time_Format %d/%b/%Y:%H:%M:%S %z
[PARSER]
Name apache_error
Format regex
Regex ^\[[^ ]* (?<time>[^\]]*)\] \[(?<level>[^\]]*)\](?: \[pid (?<pid>[^\]]*)\])?( \[client (?<client>[^\]]*)\])? (?<message>.*)$
[PARSER]
Name nginx
Format regex
Regex ^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
Time_Key time
Time_Format %d/%b/%Y:%H:%M:%S %z
[PARSER]
Name json-test
Format json
Time_Key time
Time_Format %d/%b/%Y:%H:%M:%S %z
[PARSER]
Name docker
Format json
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%L
Time_Keep On
[PARSER]
Name syslog
Format regex
Regex ^\<(?<pri>[0-9]+)\>(?<time>[^ ]* {1,2}[^ ]* [^ ]*) (?<host>[^ ]*) (?<ident>[a-zA-Z0-9_\/\.\-]*)(?:\[(?<pid>[0-9]+)\])?(?:[^\:]*\:)? *(?<message>.*)$
Time_Key time
Time_Format %b %d %H:%M:%S
16 changes: 15 additions & 1 deletion fluent-bit-daemonset-elasticsearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@ metadata:
version: v1
kubernetes.io/cluster-service: "true"
spec:
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
k8s-app: fluent-bit-logging
version: v1
kubernetes.io/cluster-service: "true"
annotations:
# This annotation ensures that fluentd does not get evicted if the node
# supports critical pod annotation based priority scheme.
# Note that this does not guarantee admission on the nodes (#40573).
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
serviceAccountName: fluent-bit-logging
containers:
- name: fluent-bit
image: fluent/fluent-bit-kubernetes-daemonset:0.11
image: globegitter/fluent-bit-kubernetes-daemonset:0.12.1
env:
- name: FLUENT_ELASTICSEARCH_HOST
value: "elasticsearch-logging"
Expand All @@ -36,6 +44,12 @@ spec:
mountPath: /var/lib/docker/containers
readOnly: true
terminationGracePeriodSeconds: 10
# Do not schedule on master nodes
tolerations:
- key: "kubernetes.io/role"
operator: "Equal"
value: "master"
effect: "NoSchedule"
volumes:
- name: varlog
hostPath:
Expand Down
44 changes: 44 additions & 0 deletions fluent-bit-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: fluentd-bit-logging
namespace: kube-system
labels:
run: fluentd-bit-logging

---

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: fluentd-bit-logging
labels:
run: fluentd-bit-logging
rules:
- apiGroups:
- ""
resources:
- "namespaces"
- "pods"
verbs:
- "get"
- "watch"
- "list"

---

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: fluentd-bit-logging
labels:
run: fluentd-bit-logging
subjects:
- kind: ServiceAccount
name: fluentd-bit-logging
namespace: kube-system
apiGroup: ""
roleRef:
kind: ClusterRole
name: fluentd-bit-logging
apiGroup: ""

0 comments on commit 6136860

Please sign in to comment.