You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.0 KiB
YAML
61 lines
1.0 KiB
YAML
---
|
|
apiVersion: v1
|
|
kind: Pod
|
|
metadata:
|
|
name: two-containers
|
|
labels:
|
|
app: sidecar-container
|
|
spec:
|
|
volumes:
|
|
- name: shared-logs
|
|
emptyDir: {}
|
|
- name: fluentd-config
|
|
configMap:
|
|
name: fluentd
|
|
containers:
|
|
- name: nginx
|
|
image: nginx
|
|
ports:
|
|
- containerPort: 80
|
|
volumeMounts:
|
|
- name: shared-logs
|
|
mountPath: /var/log/nginx
|
|
- name: fluentd
|
|
image: fluent/fluentd:v1.11-1
|
|
volumeMounts:
|
|
- 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
|