kubernetes-hands-on/16-sidecar-containers/01-sidecar.yml

61 lines
1.0 KiB
YAML
Raw Normal View History

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