-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.yaml
497 lines (480 loc) · 15.9 KB
/
test.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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
############################################
# NOTE: This file is managed by Terraform #
# Don't make any manual modification to it #
############################################
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
creationTimestamp: null
name: vv-ig-node.cloud-platform.service.justice.gov.uk
spec:
docker:
registryMirrors:
# The docker-registry-cache is defined in terraform/cloud-platform-components/docker-registry-cache.tf
- https://docker-registry-cache.apps.vv-ig-node.cloud-platform.service.justice.gov.uk
fileAssets:
- name: kubernetes-audit
path: /srv/kubernetes/audit.yaml
roles: [Master]
content: |
# The following audit policy is based on two sources from upstream:
# - the kubernetes docs example: https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/audit/audit-policy.yaml
# - the GCE reference policy: https://github.com/kubernetes/kubernetes/blob/master/cluster/gce/gci/configure-helper.sh#L784
#
apiVersion: audit.k8s.io/v1beta1
kind: Policy
omitStages:
- "RequestReceived"
rules:
# The following requests were manually identified as high-volume and low-risk,
# so drop them.
- level: None
users: ["system:kube-proxy"]
verbs: ["watch"]
resources:
- group: "" # core
resources: ["endpoints", "services", "services/status"]
- level: None
namespaces: ["ingress-controllers"]
verbs: ["get"]
resources:
- group: "" # core
resources: ["configmaps"]
resourceNames: ["ingress-controller-leader-nginx"]
- level: None
users: ["kubelet"] # legacy kubelet identity
verbs: ["get"]
resources:
- group: "" # core
resources: ["nodes", "nodes/status"]
- level: None
userGroups: ["system:nodes"]
verbs: ["get"]
resources:
- group: "" # core
resources: ["nodes", "nodes/status"]
- level: None
users:
- system:kube-controller-manager
- system:kube-scheduler
- system:serviceaccount:kube-system:endpoint-controller
verbs: ["get", "update"]
namespaces: ["kube-system"]
resources:
- group: "" # core
resources: ["endpoints"]
- level: None
users: ["system:apiserver"]
verbs: ["get"]
resources:
- group: "" # core
resources: ["namespaces", "namespaces/status", "namespaces/finalize"]
# Don't log HPA fetching metrics.
- level: None
users:
- system:kube-controller-manager
verbs: ["get", "list"]
resources:
- group: "metrics.k8s.io"
# Don't log these read-only URLs.
- level: None
nonResourceURLs:
- /healthz*
- /version
- /swagger*
# Don't log authenticated requests to certain non-resource URL paths.
- level: None
userGroups: ["system:authenticated"]
nonResourceURLs:
- "/api*"
# Don't log events requests.
- level: None
resources:
- group: "" # core
resources: ["events"]
# Log "pods/log", "pods/status" at Metadata level
- level: Metadata
resources:
- group: ""
resources: ["pods/log", "pods/status"]
# node and pod status calls from nodes are high-volume and can be large, don't log responses for expected updates from nodes
- level: Request
users: ["kubelet", "system:node-problem-detector", "system:serviceaccount:kube-system:node-problem-detector"]
verbs: ["update","patch"]
resources:
- group: "" # core
resources: ["nodes/status", "pods/status"]
- level: Request
userGroups: ["system:nodes"]
verbs: ["update","patch"]
resources:
- group: "" # core
resources: ["nodes/status", "pods/status"]
# deletecollection calls can be large, don't log responses for expected namespace deletions
- level: Request
users: ["system:serviceaccount:kube-system:namespace-controller"]
verbs: ["deletecollection"]
# Secrets, ConfigMaps, and TokenReviews can contain sensitive & binary data,
# so only log at the Metadata level.
- level: Metadata
resources:
- group: "" # core
resources: ["secrets", "configmaps"]
- group: authentication.k8s.io
resources: ["tokenreviews"]
# Get repsonses can be large; skip them.
- level: Request
verbs: ["get", "list", "watch"]
resources:
- group: "" # core
- group: "admissionregistration.k8s.io"
- group: "apiextensions.k8s.io"
- group: "apiregistration.k8s.io"
- group: "apps"
- group: "authentication.k8s.io"
- group: "authorization.k8s.io"
- group: "autoscaling"
- group: "batch"
- group: "certificates.k8s.io"
- group: "extensions"
- group: "metrics.k8s.io"
- group: "networking.k8s.io"
- group: "policy"
- group: "rbac.authorization.k8s.io"
- group: "scheduling.k8s.io"
- group: "settings.k8s.io"
- group: "storage.k8s.io"
# Default level for known APIs
- level: RequestResponse
resources:
- group: "" # core
- group: "admissionregistration.k8s.io"
- group: "apiextensions.k8s.io"
- group: "apiregistration.k8s.io"
- group: "apps"
- group: "authentication.k8s.io"
- group: "authorization.k8s.io"
- group: "autoscaling"
- group: "batch"
- group: "certificates.k8s.io"
- group: "extensions"
- group: "metrics.k8s.io"
- group: "networking.k8s.io"
- group: "policy"
- group: "rbac.authorization.k8s.io"
- group: "scheduling.k8s.io"
- group: "settings.k8s.io"
- group: "storage.k8s.io"
# Default level for all other requests.
- level: Metadata
omitStages:
- "RequestReceived"
kubeDNS:
provider: CoreDNS
api:
loadBalancer:
type: Public
authorization:
rbac: {}
channel: stable
cloudProvider: aws
sshKeyName: vv-ig-node.cloud-platform.service.justice.gov.uk
configBase: s3://cloud-platform-kops-state/vv-ig-node.cloud-platform.service.justice.gov.uk
dnsZone: vv-ig-node.cloud-platform.service.justice.gov.uk
etcdClusters:
- etcdMembers:
- instanceGroup: master-eu-west-2a
name: a
encryptedVolume: true
kmsKeyId: "arn:aws:kms:eu-west-2:754256621582:key/0f801fba-d154-435d-b4e7-2d7fdcb9e52c"
- instanceGroup: master-eu-west-2b
name: b
encryptedVolume: true
kmsKeyId: "arn:aws:kms:eu-west-2:754256621582:key/0f801fba-d154-435d-b4e7-2d7fdcb9e52c"
- instanceGroup: master-eu-west-2c
name: c
encryptedVolume: true
kmsKeyId: "arn:aws:kms:eu-west-2:754256621582:key/0f801fba-d154-435d-b4e7-2d7fdcb9e52c"
name: main
version: 3.3.10
- etcdMembers:
- instanceGroup: master-eu-west-2a
name: a
encryptedVolume: true
kmsKeyId: "arn:aws:kms:eu-west-2:754256621582:key/0f801fba-d154-435d-b4e7-2d7fdcb9e52c"
- instanceGroup: master-eu-west-2b
name: b
encryptedVolume: true
kmsKeyId: "arn:aws:kms:eu-west-2:754256621582:key/0f801fba-d154-435d-b4e7-2d7fdcb9e52c"
- instanceGroup: master-eu-west-2c
name: c
encryptedVolume: true
kmsKeyId: "arn:aws:kms:eu-west-2:754256621582:key/0f801fba-d154-435d-b4e7-2d7fdcb9e52c"
name: events
version: 3.3.10
iam:
allowContainerRegistry: true
legacy: false
kubelet:
anonymousAuth: false
readOnlyPort: 0
authenticationTokenWebhook: true
kubeAPIServer:
oidcClientID: IlMw2DW5ZjyEpynVt4TTImaojTfUUgvp
oidcIssuerURL: https://justice-cloud-platform.eu.auth0.com/
oidcUsernameClaim: nickname
oidcGroupsClaim: https://k8s.integration.dsd.io/groups
auditLogPath: /var/log/kube-apiserver-audit.log
auditLogMaxAge: 10
auditLogMaxBackups: 1
auditLogMaxSize: 100
auditPolicyFile: /srv/kubernetes/audit.yaml
enableAdmissionPlugins:
- NamespaceLifecycle
- LimitRanger
- ServiceAccount
- DefaultStorageClass
- DefaultTolerationSeconds
- MutatingAdmissionWebhook
- ValidatingAdmissionWebhook
- NodeRestriction
- ResourceQuota
- PodSecurityPolicy
featureGates:
TTLAfterFinished: "true"
kubeControllerManager:
featureGates:
TTLAfterFinished: "true"
kubeProxy:
metricsBindAddress: 0.0.0.0
kubernetesApiAccess:
- 0.0.0.0/0
kubernetesVersion: 1.16.13
masterPublicName: api.vv-ig-node.cloud-platform.service.justice.gov.uk
networkCIDR: 172.20.0.0/16
networkID: vpc-09df8f4e3c5db810f
networking:
calico: {}
nonMasqueradeCIDR: 100.64.0.0/10
sshAccess:
- 0.0.0.0/0
subnets:
- cidr: 172.20.32.0/19
id: subnet-0a1d3faf2cb15e014
name: eu-west-2a
type: Private
zone: eu-west-2a
- cidr: 172.20.64.0/19
id: subnet-0c56ac0eab36302e4
name: eu-west-2b
type: Private
zone: eu-west-2b
- cidr: 172.20.96.0/19
id: subnet-05f116d799acfc670
name: eu-west-2c
type: Private
zone: eu-west-2c
- cidr: 172.20.0.0/22
id: subnet-0571b6657a8e99776
name: utility-eu-west-2a
type: Utility
zone: eu-west-2a
- cidr: 172.20.4.0/22
id: subnet-0a5ce122429ec8269
name: utility-eu-west-2b
type: Utility
zone: eu-west-2b
- cidr: 172.20.8.0/22
id: subnet-03023613de7cc711f
name: utility-eu-west-2c
type: Utility
zone: eu-west-2c
topology:
dns:
type: Public
masters: private
nodes: private
hooks:
- name: authorized-keys-manager.service
roles:
- Master
- Node
manifest: |
[Unit]
Description=authorized-keys-manager
[Service]
ExecStart=/bin/bash -c '\
while true; do \
ak=$(curl -Lfs https://raw.githubusercontent.com/ministryofjustice/cloud-platform-terraform-bastion/main/files/authorized_keys.txt) \
&& [ ! -z "$$ak" ] \
&& echo "$$ak" > /home/admin/.ssh/authorized_keys; \
sleep 60; \
done;'
[Install]
WantedBy=multi-user.target
---
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: null
labels:
kops.k8s.io/cluster: vv-ig-node.cloud-platform.service.justice.gov.uk
name: master-eu-west-2a
spec:
image: kope.io/k8s-1.16-debian-stretch-amd64-hvm-ebs-2020-01-17
machineType: c5.large
maxSize: 1
minSize: 1
nodeLabels:
kops.k8s.io/instancegroup: master-eu-west-2a
cloudLabels:
application: moj-cloud-platform
business-unit: platforms
is-production: "true"
role: master
owner: cloud-platform:platforms@digital.justice.gov.uk
source-code: https://github.com/ministryofjustice/cloud-platform-infrastructure
role: Master
subnets:
- eu-west-2a
---
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: null
labels:
kops.k8s.io/cluster: vv-ig-node.cloud-platform.service.justice.gov.uk
name: master-eu-west-2b
spec:
image: kope.io/k8s-1.16-debian-stretch-amd64-hvm-ebs-2020-01-17
machineType: c5.large
maxSize: 1
minSize: 1
nodeLabels:
kops.k8s.io/instancegroup: master-eu-west-2b
cloudLabels:
application: moj-cloud-platform
business-unit: platforms
is-production: "true"
role: master
owner: cloud-platform:platforms@digital.justice.gov.uk
source-code: https://github.com/ministryofjustice/cloud-platform-infrastructure
role: Master
subnets:
- eu-west-2b
---
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: null
labels:
kops.k8s.io/cluster: vv-ig-node.cloud-platform.service.justice.gov.uk
name: master-eu-west-2c
spec:
image: kope.io/k8s-1.16-debian-stretch-amd64-hvm-ebs-2020-01-17
machineType: c5.large
maxSize: 1
minSize: 1
nodeLabels:
kops.k8s.io/instancegroup: master-eu-west-2c
cloudLabels:
application: moj-cloud-platform
business-unit: platforms
is-production: "true"
role: master
owner: cloud-platform:platforms@digital.justice.gov.uk
source-code: https://github.com/ministryofjustice/cloud-platform-infrastructure
role: Master
subnets:
- eu-west-2c
---
########################################################################################################################################
# #
# NOTE: Label "cloud-platform-recycle-nodes: true" in this multiple Availability Zone InstanceGroups, used for node-recycler. #
# #
# https://github.com/ministryofjustice/cloud-platform-infrastructure/blob/091ff8cc054fb2f87734edef8de28dd31d71b0b2/recycle-node.rb#L93 #
# #
########################################################################################################################################
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: null
labels:
kops.k8s.io/cluster: vv-ig-node.cloud-platform.service.justice.gov.uk
cloud-platform-recycle-nodes: "true"
name: nodes-1.16.13-eu-west-2a
spec:
image: kope.io/k8s-1.16-debian-stretch-amd64-hvm-ebs-2020-01-17
machineType: r5.large
maxSize: 1
minSize: 1
rootVolumeSize: 256
nodeLabels:
kops.k8s.io/instancegroup: nodes-1.16.13-eu-west-2a
cloudLabels:
application: moj-cloud-platform
business-unit: platforms
is-production: "true"
k8s.io/cluster/vv-ig-node.cloud-platform.service.justice.gov.uk: ""
role: node
owner: cloud-platform:platforms@digital.justice.gov.uk
source-code: https://github.com/ministryofjustice/cloud-platform-infrastructure
role: Node
subnets:
- eu-west-2a
---
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: null
labels:
kops.k8s.io/cluster: vv-ig-node.cloud-platform.service.justice.gov.uk
cloud-platform-recycle-nodes: "true"
name: nodes-1.16.13-eu-west-2b
spec:
image: kope.io/k8s-1.16-debian-stretch-amd64-hvm-ebs-2020-01-17
machineType: r5.large
maxSize: 1
minSize: 1
rootVolumeSize: 256
nodeLabels:
kops.k8s.io/instancegroup: nodes-1.16.13-eu-west-2b
cloudLabels:
application: moj-cloud-platform
business-unit: platforms
is-production: "true"
k8s.io/cluster/vv-ig-node.cloud-platform.service.justice.gov.uk: ""
role: node
owner: cloud-platform:platforms@digital.justice.gov.uk
source-code: https://github.com/ministryofjustice/cloud-platform-infrastructure
role: Node
subnets:
- eu-west-2b
---
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: null
labels:
kops.k8s.io/cluster: vv-ig-node.cloud-platform.service.justice.gov.uk
cloud-platform-recycle-nodes: "true"
name: nodes-1.16.13-eu-west-2c
spec:
image: kope.io/k8s-1.16-debian-stretch-amd64-hvm-ebs-2020-01-17
machineType: r5.large
maxSize: 1
minSize: 1
rootVolumeSize: 256
nodeLabels:
kops.k8s.io/instancegroup: nodes-1.16.13-eu-west-2c
cloudLabels:
application: moj-cloud-platform
business-unit: platforms
is-production: "true"
k8s.io/cluster/vv-ig-node.cloud-platform.service.justice.gov.uk: ""
role: node
owner: cloud-platform:platforms@digital.justice.gov.uk
source-code: https://github.com/ministryofjustice/cloud-platform-infrastructure
role: Node
subnets:
- eu-west-2c