k8s 部署filebeat
时间: 2023-12-20 17:32:23 浏览: 191
```shell
kubectl apply -f filebeat-configmap.yaml
kubectl apply -f filebeat-daemonset.yaml
```
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: filebeat-config
namespace: logging
data:
filebeat.yml: |-
filebeat.inputs:
- type: log
paths:
- /var/log/*.log
output.elasticsearch:
hosts: ['es_host:9200']
```
```yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: filebeat
namespace: logging
spec:
selector:
matchLabels:
name: filebeat
template:
metadata:
labels:
name: filebeat
spec:
containers:
- name: filebeat
image: docker.elastic.co/beats/filebeat:7.10.0
volumeMounts:
- name: config
mountPath: /usr/share/filebeat/filebeat.yml
subPath: filebeat.yml
- name: data
mountPath: /usr/share/filebeat/data
readOnly: false
volumes:
- name: config
configMap:
name: filebeat-config
- name: data
emptyDir: {}
```
阅读全文