blob: de1660ad72ddbfe02dbd241f3ba0eb30308278de [file] [log] [blame]
Zack Williams41513bf2018-07-07 20:08:35 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Richard Jankowskic9d89202018-01-25 10:25:10 -050014#
15# This file describes a cluster of 3 fluentd forwarders that
16# send logs to a cluster of 2 fluentd aggregators: one active
17# and one standby.
18#
19# The active fluentd aggregator
20#
21apiVersion: v1
22kind: Service
23metadata:
24 name: fluentdactv
Richard Jankowskid4454382018-02-08 16:21:43 -050025 namespace: voltha
Richard Jankowskic9d89202018-01-25 10:25:10 -050026spec:
27 clusterIP: None
28 selector:
29 app: fluentdactv
30 ports:
31 - protocol: TCP
32 port: 24224
33 targetPort: 24224
34---
35#
36# Ensure that the active aggregator is not deployed to the
37# same node as the standby
38#
39apiVersion: apps/v1beta1
40kind: Deployment
41metadata:
42 name: fluentdactv
Richard Jankowskid4454382018-02-08 16:21:43 -050043 namespace: voltha
Richard Jankowskic9d89202018-01-25 10:25:10 -050044spec:
45 replicas: 1
46 template:
47 metadata:
48 labels:
49 app: fluentdactv
Stephane Barbarie5e8d9e42018-02-07 16:15:05 -050050 annotations:
Stephane Barbarie2d4e07f2018-03-26 16:46:45 -040051 cni: "calico"
Richard Jankowskic9d89202018-01-25 10:25:10 -050052 spec:
53 terminationGracePeriodSeconds: 10
54 affinity:
55 podAntiAffinity:
56 requiredDuringSchedulingIgnoredDuringExecution:
57 - labelSelector:
58 matchExpressions:
59 - key: app
60 operator: In
61 values:
62 - fluentdstby
63 topologyKey: kubernetes.io/hostname
64 containers:
65 - name: fluentdactv
khenaidoo1ee03e42018-02-20 12:45:41 -050066 image: k8s.gcr.io/fluentd-gcp:1.30
Richard Jankowskic9d89202018-01-25 10:25:10 -050067 imagePullPolicy: Never
68 volumeMounts:
69 - name: fluentd-log
70 mountPath: /fluentd/log
khenaidoo1ee03e42018-02-20 12:45:41 -050071 - name: config-volume
72 mountPath: /etc/fluentd-config
Richard Jankowskic9d89202018-01-25 10:25:10 -050073 ports:
74 - containerPort: 24224
75 env:
khenaidoo1ee03e42018-02-20 12:45:41 -050076 - name: FLUENTD_ARGS
77 value: -c /etc/fluentd-config/fluentd-agg.conf
Richard Jankowskic9d89202018-01-25 10:25:10 -050078 volumes:
khenaidoo1ee03e42018-02-20 12:45:41 -050079 - name: config-volume
80 configMap:
81 name: fluentd-config
Richard Jankowskic9d89202018-01-25 10:25:10 -050082 - name: fluentd-log
83 hostPath:
84 path: /var/log/voltha/logging_volume
85 type: Directory
86---
87#
88# The standby fluentd aggregator
89#
90apiVersion: v1
91kind: Service
92metadata:
93 name: fluentdstby
Richard Jankowskid4454382018-02-08 16:21:43 -050094 namespace: voltha
Richard Jankowskic9d89202018-01-25 10:25:10 -050095spec:
96 clusterIP: None
97 selector:
98 app: fluentdstby
99 ports:
100 - protocol: TCP
101 port: 24224
102 targetPort: 24224
103---
104#
105# Ensure thet the standby aggregator is not deployed to the
106# same node as the active
107#
108apiVersion: apps/v1beta1
109kind: Deployment
110metadata:
111 name: fluentdstby
Richard Jankowskid4454382018-02-08 16:21:43 -0500112 namespace: voltha
Richard Jankowskic9d89202018-01-25 10:25:10 -0500113spec:
114 replicas: 1
115 template:
116 metadata:
117 labels:
118 app: fluentdstby
Stephane Barbarie5e8d9e42018-02-07 16:15:05 -0500119 annotations:
Stephane Barbarie2d4e07f2018-03-26 16:46:45 -0400120 cni: "calico"
Richard Jankowskic9d89202018-01-25 10:25:10 -0500121 spec:
122 terminationGracePeriodSeconds: 10
123 affinity:
124 podAntiAffinity:
125 requiredDuringSchedulingIgnoredDuringExecution:
126 - labelSelector:
127 matchExpressions:
128 - key: app
129 operator: In
130 values:
131 - fluentdactv
132 topologyKey: kubernetes.io/hostname
133 containers:
134 - name: fluentdstby
khenaidoo1ee03e42018-02-20 12:45:41 -0500135 image: k8s.gcr.io/fluentd-gcp:1.30
Richard Jankowskic9d89202018-01-25 10:25:10 -0500136 imagePullPolicy: Never
137 volumeMounts:
138 - name: fluentd-log
139 mountPath: /fluentd/log
khenaidoo1ee03e42018-02-20 12:45:41 -0500140 - name: config-volume
141 mountPath: /etc/fluentd-config
Richard Jankowskic9d89202018-01-25 10:25:10 -0500142 ports:
143 - containerPort: 24224
144 env:
khenaidoo1ee03e42018-02-20 12:45:41 -0500145 - name: FLUENTD_ARGS
146 value: -c /etc/fluentd-config/fluentd-agg.conf
Richard Jankowskic9d89202018-01-25 10:25:10 -0500147 volumes:
khenaidoo1ee03e42018-02-20 12:45:41 -0500148 - name: config-volume
149 configMap:
150 name: fluentd-config
Richard Jankowskic9d89202018-01-25 10:25:10 -0500151 - name: fluentd-log
152 hostPath:
153 path: /var/log/voltha/logging_volume
154 type: Directory
155---
156#
khenaidoo1ee03e42018-02-20 12:45:41 -0500157# The cluster of fluentd forwarders. The service itself will be removed once all fluentd forwarding logic are removed
158# from the specific voltha services. Fluentd is defined as a DaemonSet which implies that only 1 instance will
159# run on each node. Each instance will also gets its configuration data from a config map (fluentd-config.yml).
Richard Jankowskic9d89202018-01-25 10:25:10 -0500160#
161apiVersion: v1
162kind: Service
163metadata:
164 name: fluentd
Richard Jankowskid4454382018-02-08 16:21:43 -0500165 namespace: voltha
Richard Jankowskic9d89202018-01-25 10:25:10 -0500166spec:
167 clusterIP: None
168 selector:
169 app: fluentd
170 ports:
171 - protocol: TCP
172 port: 24224
173 targetPort: 24224
174---
khenaidoo1ee03e42018-02-20 12:45:41 -0500175apiVersion: extensions/v1beta1
176kind: DaemonSet
Richard Jankowskic9d89202018-01-25 10:25:10 -0500177metadata:
178 name: fluentd
Richard Jankowskid4454382018-02-08 16:21:43 -0500179 namespace: voltha
Richard Jankowskic9d89202018-01-25 10:25:10 -0500180spec:
khenaidoo1ee03e42018-02-20 12:45:41 -0500181 template:
Richard Jankowskic9d89202018-01-25 10:25:10 -0500182 metadata:
183 labels:
184 app: fluentd
Stephane Barbarie5e8d9e42018-02-07 16:15:05 -0500185 annotations:
Stephane Barbarie2d4e07f2018-03-26 16:46:45 -0400186 cni: "calico"
Richard Jankowskic9d89202018-01-25 10:25:10 -0500187 spec:
khenaidoo1ee03e42018-02-20 12:45:41 -0500188 tolerations:
189 - key: node-role.kubernetes.io/master
190 effect: NoSchedule
Richard Jankowskic9d89202018-01-25 10:25:10 -0500191 containers:
192 - name: fluentd
khenaidoo1ee03e42018-02-20 12:45:41 -0500193 image: k8s.gcr.io/fluentd-gcp:1.30
Richard Jankowskic9d89202018-01-25 10:25:10 -0500194 env:
khenaidoo1ee03e42018-02-20 12:45:41 -0500195 - name: FLUENTD_ARGS
196 value: -c /etc/fluentd-config/fluentd.conf
197 volumeMounts:
198 - name: varlog
199 mountPath: /var/log/
200 - name: varlogcontainers
201 mountPath: /var/lib/docker/containers/
202 - name: config-volume
203 mountPath: /etc/fluentd-config
204 volumes:
205 - name: varlog
206 hostPath:
207 path: /var/log/
208 - name: varlogcontainers
209 hostPath:
210 path: /var/lib/docker/containers/
211 - name: config-volume
212 configMap:
213 name: fluentd-config