-
Notifications
You must be signed in to change notification settings - Fork 12
/
squid-pre.yaml
284 lines (284 loc) · 6.91 KB
/
squid-pre.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
apiVersion: v1
data:
unbound.conf: |
server:
do-daemonize: no
interface: 0.0.0.0
interface-automatic: yes
access-control: 10.64.0.0/12 allow
chroot: ""
username: ""
directory: "/etc/unbound"
logfile: ""
use-syslog: no
log-time-ascii: yes
log-queries: yes
log-replies: yes
log-local-actions: yes
log-servfail: yes
rrset-roundrobin: yes
minimal-responses: yes
extended-statistics: yes
rrset-cache-size: 256m
msg-cache-size: 256m
pidfile: "/tmp/unbound.pid"
infra-host-ttl: 60
prefetch: yes
root-hints: "/usr/local/unbound/etc/unbound/root.hints"
trust-anchor-file: "/usr/local/unbound/etc/unbound/root.key"
remote-control:
control-enable: yes
control-interface: 127.0.0.1
control-use-cert: no
kind: ConfigMap
metadata:
name: local-unbound
namespace: internet-egress
---
apiVersion: v1
data:
squid.conf: |-
acl neco_network src 10.64.0.0/12
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager
http_access allow neco_network
http_access deny all
http_port 3128
cache_mem 6 GB
maximum_object_size_in_memory 100 MB
detect_broken_pconn on
forwarded_for delete
httpd_suppress_version_string on
shutdown_lifetime 10 seconds
pid_filename none
logfile_rotate 0
access_log stdio:/dev/stdout
cache_log stdio:/dev/stderr
kind: ConfigMap
metadata:
name: squid
namespace: internet-egress
---
apiVersion: v1
kind: Service
metadata:
name: squid
namespace: internet-egress
spec:
ports:
- nodePort: 30128
port: 3128
protocol: TCP
targetPort: 3128
selector:
app.kubernetes.io/name: squid
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: squid
namespace: internet-egress
spec:
replicas: 3
selector:
matchLabels:
app.kubernetes.io/name: squid
strategy:
rollingUpdate:
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app.kubernetes.io/name: squid
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- squid
topologyKey: cke.cybozu.com/rack
weight: 100
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- squid
topologyKey: kubernetes.io/hostname
containers:
- args:
- -f
- /etc/squid-conf/squid.conf
image: ghcr.io/cybozu/squid:6.10.0.1
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- sleep
- "5"
livenessProbe:
failureThreshold: 6
initialDelaySeconds: 10
periodSeconds: 1
tcpSocket:
port: 3128
name: squid
ports:
- containerPort: 3128
name: proxy
protocol: TCP
readinessProbe:
periodSeconds: 1
tcpSocket:
port: 3128
resources:
limits:
cpu: 1000m
memory: 4400Mi
requests:
cpu: 50m
memory: 440Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- all
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /var/spool/squid
name: cache
- mountPath: /etc/squid-conf
name: config
- args:
- -c
- /etc/unbound/unbound.conf
image: ghcr.io/cybozu/unbound:1.20.0.2
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- sleep
- "5"
livenessProbe:
failureThreshold: 6
initialDelaySeconds: 1
periodSeconds: 1
tcpSocket:
port: 53
name: unbound
ports:
- containerPort: 53
name: dns
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
readinessProbe:
periodSeconds: 1
tcpSocket:
port: 53
resources:
limits:
cpu: 250m
memory: 500Mi
requests:
cpu: 25m
memory: 50Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
add:
- NET_BIND_SERVICE
drop:
- all
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /etc/unbound
name: config-volume
readOnly: true
- mountPath: /tmp
name: temporary-volume
- args:
- --unbound.ca=
- --unbound.cert=
image: ghcr.io/cybozu/unbound_exporter:0.4.6.2
imagePullPolicy: IfNotPresent
name: exporter
ports:
- containerPort: 9167
name: metrics
resources:
requests:
cpu: 100m
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- all
readOnlyRootFilesystem: true
runAsGroup: 10000
runAsUser: 10000
- image: ghcr.io/cybozu/squid-exporter:1.0.6
imagePullPolicy: IfNotPresent
name: squid-exporter
ports:
- containerPort: 9100
name: squid-metrics
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- all
readOnlyRootFilesystem: true
runAsGroup: 10000
runAsUser: 10000
dnsConfig:
nameservers:
- 127.0.0.1
dnsPolicy: None
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
- key: CriticalAddonsOnly
operator: Exists
- effect: NoExecute
key: node.cybozu.io/cluster-not-ready
operator: Exists
volumes:
- emptyDir: {}
name: cache
- configMap:
name: squid
name: config
- configMap:
items:
- key: unbound.conf
path: unbound.conf
name: local-unbound
name: config-volume
- emptyDir: {}
name: temporary-volume
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: squid-pdb
namespace: internet-egress
spec:
maxUnavailable: 1
selector:
matchLabels:
app.kubernetes.io/name: squid