2019-05-14 22:04:12 +06:00
|
|
|
---
|
2019-05-14 21:56:47 +06:00
|
|
|
apiVersion: v1
|
|
|
|
kind: Pod
|
|
|
|
metadata:
|
|
|
|
name: two-containers
|
2020-11-12 21:37:35 +06:00
|
|
|
labels:
|
|
|
|
app: sidecar-container
|
2019-05-14 21:56:47 +06:00
|
|
|
spec:
|
|
|
|
volumes:
|
2020-11-12 21:37:35 +06:00
|
|
|
- name: shared-logs
|
2019-05-14 22:04:12 +06:00
|
|
|
emptyDir: {}
|
2020-11-12 21:37:35 +06:00
|
|
|
- name: fluentd-config
|
|
|
|
configMap:
|
|
|
|
name: fluentd
|
2019-05-14 21:56:47 +06:00
|
|
|
containers:
|
2019-05-14 22:04:12 +06:00
|
|
|
- name: nginx
|
|
|
|
image: nginx
|
2020-11-12 21:37:35 +06:00
|
|
|
ports:
|
|
|
|
- containerPort: 80
|
2019-05-14 22:04:12 +06:00
|
|
|
volumeMounts:
|
2020-11-12 21:37:35 +06:00
|
|
|
- name: shared-logs
|
|
|
|
mountPath: /var/log/nginx
|
|
|
|
- name: fluentd
|
|
|
|
image: fluent/fluentd:v1.11-1
|
2019-05-14 22:04:12 +06:00
|
|
|
volumeMounts:
|
2020-11-12 21:37:35 +06:00
|
|
|
- name: shared-logs
|
|
|
|
mountPath: /logs
|
|
|
|
- name: fluentd-config
|
|
|
|
mountPath: /fluentd/etc
|
|
|
|
---
|
|
|
|
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>
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: nginx
|
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- port: 80
|
|
|
|
targetPort: 80
|
|
|
|
selector:
|
|
|
|
app: sidecar-container
|