Skip to content

Instantly share code, notes, and snippets.

@vjayajv
Created March 21, 2023 12:36
Show Gist options
  • Save vjayajv/38e4279324740c79da679d9fbbcaef83 to your computer and use it in GitHub Desktop.
Save vjayajv/38e4279324740c79da679d9fbbcaef83 to your computer and use it in GitHub Desktop.
Filebeat.yml for the death of dockershim
---
apiVersion: v1
kind: ConfigMap
metadata:
name: filebeat-config
labels:
k8s-app: filebeat
data:
filebeat.yml: |-
filebeat.inputs:
- type: log
enabled: true
symlinks: true
paths:
- /var/log/containers/*.log
output.logstash:
hosts: ["${LOGSTASH_HOST}:${LOGSTASH_PORT}"]
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: filebeat
labels:
k8s-app: filebeat
spec:
selector:
matchLabels:
k8s-app: filebeat
template:
metadata:
labels:
k8s-app: filebeat
spec:
serviceAccountName: filebeat
terminationGracePeriodSeconds: 30
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: filebeat
image: docker.elastic.co/beats/filebeat:7.17.9
args: [
"-c", "/etc/filebeat.yml",
"-e",
]
env:
- name: LOGSTASH_HOST
value: "logstash"
- name: LOGSTASH_PORT
value: "5100"
securityContext:
runAsUser: 0
#If using Red Hat OpenShift uncomment this:
#privileged: true
resources:
limits:
memory: 200Mi
requests:
cpu: 100m
memory: 100Mi
volumeMounts:
- name: config
mountPath: /etc/filebeat.yml
readOnly: true
subPath: filebeat.yml
- name: data
mountPath: /usr/share/filebeat/data
- name: varlogcontainers
mountPath: /var/log/containers
readOnly: true
- name: varlogpods
mountPath: /var/log/pods
readOnly: true
- name: dockersock
mountPath: "/var/run/docker.sock"
volumes:
# Bind previously defined ConfigMap
- name: dockersock
hostPath:
path: /var/run/docker.sock
- name: config
configMap:
defaultMode: 0600
name: filebeat-config
- name: varlogcontainers
hostPath:
path: /var/log/containers
- name: varlogpods
hostPath:
path: /var/log/pods
# data folder stores a registry of read status for all files, so we don't send everything again on a Filebeat pod restart
- name: data
hostPath:
path: /var/lib/filebeat-data
type: DirectoryOrCreate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment