Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregate container logs to Kafka using Fluent Bit #131

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions logs-streaming/test/logs-fluentbit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
kind: ConfigMap
metadata:
name: logs-fluentbit
namespace: test-kafka
apiVersion: v1
data:

setup.sh: |-
touch /tmp/testlog

tail -f /tmp/testlog

test.sh: |-
exec >> /tmp/testlog
exec 2>&1

echo ""
echo "{\"#---\":\"$(date -u --iso-8601='ns')\"}"
kafkacat -b $BOOTSTRAP -C -t $TOPIC -f '{"#topic":"%t","#partition":%p,"#offset":%o,"#key":"%k","=":%s}\n' -o -10 -e -q

exit 0

quit-on-nonzero-exit.sh: |-
exit 0

---
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: logs-fluentbit
namespace: test-kafka
spec:
replicas: 1
selector:
matchLabels:
test-target: logs-streaming-fluentbit
test-type: readiness
template:
metadata:
labels:
test-target: logs-streaming-fluentbit
test-type: readiness
spec:
containers:
- name: testcase
image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef
env:
- name: BOOTSTRAP
value: bootstrap.kafka:9092
- name: TOPIC
value: ops.kube-logs-fluentbit.stream.json.001
command:
- /bin/bash
- -e
- /test/setup.sh
readinessProbe:
exec:
command:
- /bin/bash
- -e
- /test/test.sh
initialDelaySeconds: 0
periodSeconds: 60
livenessProbe:
exec:
command:
- /bin/bash
- -e
- /test/quit-on-nonzero-exit.sh
volumeMounts:
- name: config
mountPath: /test
volumes:
- name: config
configMap:
name: logs-fluentbit