Log collection example for sidecar containers
This commit is contained in:
parent
10b545a97d
commit
20ecd50b0a
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: fluentd
|
||||
data:
|
||||
fluent.conf: |
|
||||
<source>
|
||||
@type tail
|
||||
path /logs/*
|
||||
pos_file /tmp/fluentd-nginx-pos.log
|
||||
tag nginx
|
||||
<parse>
|
||||
@type nginx
|
||||
</parse>
|
||||
</source>
|
||||
|
||||
<match nginx>
|
||||
@type stdout
|
||||
</match>
|
|
@ -5,18 +5,21 @@ metadata:
|
|||
name: two-containers
|
||||
spec:
|
||||
volumes:
|
||||
- name: shared-data
|
||||
- name: shared-logs
|
||||
emptyDir: {}
|
||||
- name: fluentd-config
|
||||
configMap:
|
||||
name: fluentd
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx
|
||||
volumeMounts:
|
||||
- name: shared-data
|
||||
mountPath: /usr/share/nginx/html
|
||||
- name: debian
|
||||
image: debian
|
||||
- name: shared-logs
|
||||
mountPath: /var/log/nginx
|
||||
- name: fluentd
|
||||
image: fluent/fluentd:v1.11-1
|
||||
volumeMounts:
|
||||
- name: shared-data
|
||||
mountPath: /pod-data
|
||||
command: ["/bin/sh"]
|
||||
args: ["-c", "echo Hello from the debian container > /pod-data/index.html"]
|
||||
- name: shared-logs
|
||||
mountPath: /logs
|
||||
- name: fluentd-config
|
||||
mountPath: /fluentd/etc
|
||||
|
|
Loading…
Reference in New Issue