forked from kmazurek244/containers_artifacts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trips-cluster.yaml
754 lines (728 loc) · 23.1 KB
/
trips-cluster.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
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
apiVersion: v1
kind: Namespace
metadata:
name: frontend
labels:
name: frontend
---
apiVersion: v1
kind: Namespace
metadata:
name: backend
labels:
name: backend
---
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: azure-kv
namespace: backend
spec:
provider: azure
secretObjects:
- secretName: sql
type: Opaque
data:
- objectName: sql-username
key: username
- objectName: sql-password
key: password
parameters:
usePodIdentity: "false"
useVMManagedIdentity: "true"
userAssignedIdentityID: 14222f08-8910-4a4a-9eba-78bf6f3b47b6
keyvaultName: kv-tripcluster-dev
cloudName: ""
objects: |
array:
- |
objectName: sql-username
objectType: secret
- |
objectName: sql-password
objectType: secret
tenantId: c0414387-ee8a-411f-b21e-8d7fce2af971
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: poi
namespace: backend
spec:
replicas: 1
selector:
matchLabels:
app: poi
template:
metadata:
labels:
app: poi
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: poi
image: registryntt1010.azurecr.io/poi:kmazurek_1.0
volumeMounts:
- name: secrets-store01-inline
mountPath: "/mnt/secrets-store"
readOnly: true
env:
- name: SQL_USER
valueFrom:
secretKeyRef:
name: sql
key: username
- name: SQL_PASSWORD
valueFrom:
secretKeyRef:
name: sql
key: password
- name: SQL_SERVER
value: sqlserverntt1010.database.windows.net
- name: SQL_DBNAME
value: mydrivingDB
- name: ASPNETCORE_ENVIRONMENT
value: Development
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 80
name: redis
volumes:
- name: secrets-store01-inline
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: azure-kv
---
apiVersion: v1
kind: Service
metadata:
name: poi-service
namespace: backend
spec:
ports:
- port: 80
selector:
app: poi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: trips
namespace: backend
spec:
replicas: 1
selector:
matchLabels:
app: trips
template:
metadata:
labels:
app: trips
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: trips
image: registryntt1010.azurecr.io/trips:kmazurek_1.0
volumeMounts:
- name: secrets-store01-inline
mountPath: "/mnt/secrets-store"
readOnly: true
env:
- name: SQL_USER
valueFrom:
secretKeyRef:
name: sql
key: username
- name: SQL_PASSWORD
valueFrom:
secretKeyRef:
name: sql
key: password
- name: SQL_SERVER
value: sqlserverntt1010.database.windows.net
- name: SQL_DBNAME
value: mydrivingDB
- name: DEBUG_LOGGING
value: "true"
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 80
name: redis
volumes:
- name: secrets-store01-inline
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: azure-kv
---
apiVersion: v1
kind: Service
metadata:
name: trips-service
namespace: backend
spec:
ports:
- port: 80
selector:
app: trips
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: userprofile
namespace: backend
spec:
replicas: 1
selector:
matchLabels:
app: userprofile
template:
metadata:
labels:
app: userprofile
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: userprofile
image: registryntt1010.azurecr.io/userprofile:dominic_1.0
volumeMounts:
- name: secrets-store01-inline
mountPath: "/mnt/secrets-store"
readOnly: true
env:
- name: SQL_USER
valueFrom:
secretKeyRef:
name: sql
key: username
- name: SQL_PASSWORD
valueFrom:
secretKeyRef:
name: sql
key: password
- name: SQL_SERVER
value: sqlserverntt1010.database.windows.net
- name: SQL_DBNAME
value: mydrivingDB
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 80
name: redis
volumes:
- name: secrets-store01-inline
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: azure-kv
---
apiVersion: v1
kind: Service
metadata:
name: userprofile-service
namespace: backend
spec:
ports:
- port: 80
selector:
app: userprofile
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: user-java
namespace: backend
spec:
replicas: 1
selector:
matchLabels:
app: user-java
template:
metadata:
labels:
app: user-java
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: user-java
image: registryntt1010.azurecr.io/user-java:dominic_1.0
volumeMounts:
- name: secrets-store01-inline
mountPath: "/mnt/secrets-store"
readOnly: true
env:
- name: SQL_USER
valueFrom:
secretKeyRef:
name: sql
key: username
- name: SQL_PASSWORD
valueFrom:
secretKeyRef:
name: sql
key: password
- name: SQL_SERVER
value: sqlserverntt1010.database.windows.net
- name: SQL_DBNAME
value: mydrivingDB
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 80
name: redis
volumes:
- name: secrets-store01-inline
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: azure-kv
---
apiVersion: v1
kind: Service
metadata:
name: user-java-service
namespace: backend
spec:
ports:
- port: 80
selector:
app: user-java
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
test: tripviewer
name: tripviewer
namespace: frontend
spec:
replicas: 1
selector:
matchLabels:
app: tripviewer
template:
metadata:
labels:
app: tripviewer
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: tripviewer
image: registryntt1010.azurecr.io/tripviewer:kmazurek_1.0
env:
- name: TRIPS_API_ENDPOINT
value: http://trips-service.backend:80
- name: USERPROFILE_API_ENDPOINT
value: http://userprofile-service.backend:80
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 80
name: redis
---
apiVersion: v1
kind: Service
metadata:
name: tripviewer-service
namespace: frontend
spec:
ports:
- port: 80
selector:
app: tripviewer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: insurance-deployment
labels:
deploy: insurance
spec:
replicas: 2
selector:
matchLabels:
app: insurance
template:
metadata:
labels:
app: insurance
spec:
containers:
- image: registryntt1010.azurecr.io/insurance:1.0
imagePullPolicy: Always
name: insurance
ports:
- containerPort: 8081
name: http
protocol: TCP
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "250m"
---
apiVersion: v1
kind: Service
metadata:
name: insurance
spec:
type: ClusterIP
selector:
app: insurance
ports:
- protocol: TCP
name: insurance-http
port: 80
targetPort: 8081
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: web-dev-backend
namespace: backend
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["get", "list", "watch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: web-dev-backend-rolebinding
namespace: backend
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: web-dev-backend
subjects:
- kind: Group
namespace: backend
name: e3c335eb-a16b-42d4-bee9-966d1c3840cf
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: web-dev-frontend
namespace: frontend
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: web-dev-frontend-rolebinding
namespace: frontend
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: web-dev-frontend
subjects:
- kind: Group
namespace: frontend
name: e3c335eb-a16b-42d4-bee9-966d1c3840cf
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: api-dev-backend
namespace: backend
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: api-dev-backend-rolebinding
namespace: backend
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: api-dev-backend
subjects:
- kind: Group
namespace: backend
name: 4700bbe2-84fd-402e-93e6-4482eb0d9337
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: api-dev-frontend
namespace: frontend
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["get", "list", "watch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: api-dev-frontend-rolebinding
namespace: frontend
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: api-dev-frontend
subjects:
- kind: Group
namespace: frontend
name: 4700bbe2-84fd-402e-93e6-4482eb0d9337
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: trips-ingress-backend
namespace: backend
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- http:
paths:
- path: /api/poi
pathType: Prefix
backend:
service:
name: poi-service
port:
number: 80
- path: /api/trips
pathType: Prefix
backend:
service:
name: trips-service
port:
number: 80
- path: /api/user
pathType: Prefix
backend:
service:
name: userprofile-service
port:
number: 80
- path: /api/user-java
pathType: Prefix
backend:
service:
name: user-java-service
port:
number: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: trips-ingress-frontend
namespace: frontend
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: tripviewer-service
port:
number: 80
---
kind: ConfigMap
apiVersion: v1
data:
schema-version:
#string.used by agent to parse config. supported versions are {v1}. Configs with other schema versions will be rejected by the agent.
v1
config-version:
#string.used by customer to keep track of this config file's version in their source control/repository (max allowed 10 chars, other chars will be truncated)
ver1
log-data-collection-settings: |-
# Log data collection settings
# Any errors related to config map settings can be found in the KubeMonAgentEvents table in the Log Analytics workspace that the cluster is sending data to.
[log_collection_settings]
[log_collection_settings.stdout]
# In the absense of this configmap, default value for enabled is true
enabled = true
# exclude_namespaces setting holds good only if enabled is set to true
# kube-system log collection is disabled by default in the absence of 'log_collection_settings.stdout' setting. If you want to enable kube-system, remove it from the following setting.
# If you want to continue to disable kube-system log collection keep this namespace in the following setting and add any other namespace you want to disable log collection to the array.
# In the absense of this configmap, default value for exclude_namespaces = ["kube-system"]
exclude_namespaces = ["kube-system"]
[log_collection_settings.stderr]
# Default value for enabled is true
enabled = true
# exclude_namespaces setting holds good only if enabled is set to true
# kube-system log collection is disabled by default in the absence of 'log_collection_settings.stderr' setting. If you want to enable kube-system, remove it from the following setting.
# If you want to continue to disable kube-system log collection keep this namespace in the following setting and add any other namespace you want to disable log collection to the array.
# In the absense of this cofigmap, default value for exclude_namespaces = ["kube-system"]
exclude_namespaces = ["kube-system"]
[log_collection_settings.env_var]
# In the absense of this configmap, default value for enabled is true
enabled = true
[log_collection_settings.enrich_container_logs]
# In the absense of this configmap, default value for enrich_container_logs is false
enabled = false
# When this is enabled (enabled = true), every container log entry (both stdout & stderr) will be enriched with container Name & container Image
[log_collection_settings.collect_all_kube_events]
# In the absense of this configmap, default value for collect_all_kube_events is false
# When the setting is set to false, only the kube events with !normal event type will be collected
enabled = false
# When this is enabled (enabled = true), all kube events including normal events will be collected
prometheus-data-collection-settings: |-
# Custom Prometheus metrics data collection settings
[prometheus_data_collection_settings.cluster]
# Cluster level scrape endpoint(s). These metrics will be scraped from agent's Replicaset (singleton)
# Any errors related to prometheus scraping can be found in the KubeMonAgentEvents table in the Log Analytics workspace that the cluster is sending data to.
#Interval specifying how often to scrape for metrics. This is duration of time and can be specified for supporting settings by combining an integer value and time unit as a string value. Valid time units are ns, us (or µs), ms, s, m, h.
interval = "1m"
## Uncomment the following settings with valid string arrays for prometheus scraping
#fieldpass = ["metric_to_pass1", "metric_to_pass12"]
#fielddrop = ["metric_to_drop"]
# An array of urls to scrape metrics from.
# urls = ["http://myurl:9101/metrics"]
# An array of Kubernetes services to scrape metrics from.
# kubernetes_services = ["http://my-service-dns.my-namespace:9102/metrics"]
# When monitor_kubernetes_pods = true, replicaset will scrape Kubernetes pods for the following prometheus annotations:
# - prometheus.io/scrape: Enable scraping for this pod
# - prometheus.io/scheme: If the metrics endpoint is secured then you will need to
# set this to `https` & most likely set the tls config.
# - prometheus.io/path: If the metrics path is not /metrics, define it with this annotation.
# - prometheus.io/port: If port is not 9102 use this annotation
monitor_kubernetes_pods = false
## Restricts Kubernetes monitoring to namespaces for pods that have annotations set and are scraped using the monitor_kubernetes_pods setting.
## This will take effect when monitor_kubernetes_pods is set to true
## ex: monitor_kubernetes_pods_namespaces = ["default1", "default2", "default3"]
# monitor_kubernetes_pods_namespaces = ["default1"]
## Label selector to target pods which have the specified label
## This will take effect when monitor_kubernetes_pods is set to true
## Reference the docs at https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
# kubernetes_label_selector = "env=dev,app=nginx"
## Field selector to target pods which have the specified field
## This will take effect when monitor_kubernetes_pods is set to true
## Reference the docs at https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/
## eg. To scrape pods on a specific node
# kubernetes_field_selector = "spec.nodeName=$HOSTNAME"
[prometheus_data_collection_settings.node]
# Node level scrape endpoint(s). These metrics will be scraped from agent's DaemonSet running in every node in the cluster
# Any errors related to prometheus scraping can be found in the KubeMonAgentEvents table in the Log Analytics workspace that the cluster is sending data to.
#Interval specifying how often to scrape for metrics. This is duration of time and can be specified for supporting settings by combining an integer value and time unit as a string value. Valid time units are ns, us (or µs), ms, s, m, h.
interval = "1m"
## Uncomment the following settings with valid string arrays for prometheus scraping
# An array of urls to scrape metrics from. $NODE_IP (all upper case) will substitute of running Node's IP address
# urls = ["http://$NODE_IP:9103/metrics"]
#fieldpass = ["metric_to_pass1", "metric_to_pass12"]
#fielddrop = ["metric_to_drop"]
metric_collection_settings: |-
# Metrics collection settings for metrics sent to Log Analytics and MDM
[metric_collection_settings.collect_kube_system_pv_metrics]
# In the absense of this configmap, default value for collect_kube_system_pv_metrics is false
# When the setting is set to false, only the persistent volume metrics outside the kube-system namespace will be collected
enabled = false
# When this is enabled (enabled = true), persistent volume metrics including those in the kube-system namespace will be collected
alertable-metrics-configuration-settings: |-
# Alertable metrics configuration settings for container resource utilization
[alertable_metrics_configuration_settings.container_resource_utilization_thresholds]
# The threshold(Type Float) will be rounded off to 2 decimal points
# Threshold for container cpu, metric will be sent only when cpu utilization exceeds or becomes equal to the following percentage
container_cpu_threshold_percentage = 95.0
# Threshold for container memoryRss, metric will be sent only when memory rss exceeds or becomes equal to the following percentage
container_memory_rss_threshold_percentage = 95.0
# Threshold for container memoryWorkingSet, metric will be sent only when memory working set exceeds or becomes equal to the following percentage
container_memory_working_set_threshold_percentage = 95.0
# Alertable metrics configuration settings for persistent volume utilization
[alertable_metrics_configuration_settings.pv_utilization_thresholds]
# Threshold for persistent volume usage bytes, metric will be sent only when persistent volume utilization exceeds or becomes equal to the following percentage
pv_usage_threshold_percentage = 60.0
# Alertable metrics configuration settings for completed jobs count
[alertable_metrics_configuration_settings.job_completion_threshold]
# Threshold for completed job count , metric will be sent only for those jobs which were completed earlier than the following threshold
job_completion_threshold_time_minutes = 360
integrations: |-
[integrations.azure_network_policy_manager]
collect_basic_metrics = false
collect_advanced_metrics = false
# Doc - https://github.com/microsoft/Docker-Provider/blob/ci_prod/Documentation/AgentSettings/ReadMe.md
agent-settings: |-
# prometheus scrape fluent bit settings for high scale
# buffer size should be greater than or equal to chunk size else we set it to chunk size.
[agent_settings.prometheus_fbit_settings]
tcp_listener_chunk_size = 10
tcp_listener_buffer_size = 10
tcp_listener_mem_buf_limit = 200
# The following settings are "undocumented", we don't recommend uncommenting them unless directed by Microsoft.
# They increase the maximum stdout/stderr log collection rate but will also cause higher cpu/memory usage.
# [agent_settings.fbit_config]
# log_flush_interval_secs = "1" # default value is 15
# tail_mem_buf_limit_megabytes = "10" # default value is 10
# tail_buf_chunksize_megabytes = "1" # default value is 32kb (comment out this line for default)
# tail_buf_maxsize_megabytes = "1" # defautl value is 32kb (comment out this line for default)
metadata:
name: container-azm-ms-agentconfig
namespace: kube-system
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: block-network-policy
namespace: backend
spec:
podSelector: {}
policyTypes:
- Ingress
- Egress
ingress:
- from:
- namespaceSelector:
matchLabels:
name: frontend
- podSelector:
matchLabels:
test: tripviewer
ports:
- protocol: TCP
port: 80
egress: []