-
Notifications
You must be signed in to change notification settings - Fork 508
/
aspnetapp.yaml
131 lines (130 loc) · 4.01 KB
/
aspnetapp.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
# ------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See License.txt in the repo root # for license information.
# ------------------------------------------------------------
apiVersion: apps/v1
kind: Deployment
metadata:
name: aspnetapp-deployment
namespace: a0008
labels:
app.kubernetes.io/name: aspnetapp
spec:
replicas: 2
selector:
matchLabels:
app.kubernetes.io/name: aspnetapp
template:
metadata:
labels:
app.kubernetes.io/name: aspnetapp
spec:
automountServiceAccountToken: false
securityContext:
runAsUser: 10001
runAsGroup: 3000
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- aspnetapp
topologyKey: "kubernetes.io/hostname"
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- traefik-ingress-ilb
topologyKey: "kubernetes.io/hostname"
containers:
- name: aspnet-webapp-sample
image: mcr.microsoft.com/dotnet/samples:aspnetapp
imagePullPolicy: Always
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: false
capabilities:
drop:
- all
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
cpu: 100m
memory: 256Mi
env:
- name: ASPNETCORE_URLS
value: "http://*:8080"
nodeSelector:
agentpool: npuser01
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: aspnetapp-pdb
namespace: a0008
spec:
minAvailable: 2
selector:
matchLabels:
app.kubernetes.io/name: aspnetapp
---
kind: Service
apiVersion: v1
metadata:
name: aspnetapp-service
namespace: a0008
spec:
selector:
app.kubernetes.io/name: aspnetapp
ports:
- name: http
port: 80
targetPort: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: aspnetapp-ingress
namespace: a0008
annotations:
kubernetes.io/ingress.allow-http: "false"
# defines controller implementing this ingress resource: https://learn.microsoft.com/en-us/azure/dev-spaces/how-to/ingress-https-traefik
# ingress.class annotation is being deprecated in Kubernetes 1.18: https://kubernetes.io/docs/concepts/services-networking/ingress/#deprecated-annotation
# For backwards compatibility, when this annotation is set, precedence is given over the new field ingressClassName under spec.
kubernetes.io/ingress.class: traefik-internal
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
traefik.ingress.kubernetes.io/router.tls.options: default
traefik.ingress.kubernetes.io/router.middlewares: app-gateway-snet@file, gzip-compress@file
spec:
# ingressClassName: "traefik-internal"
tls:
- hosts:
- bu0001a0008-00.aks-ingress.contoso.com
# it is possible to opt for certificate management strategy with dedicated
# certificates for each TLS SNI route.
# In this rereference implementation for the sake of simplicity we use a
# wildcard default certificate added at Ingress Controller configuration level which is *.example.com
# secretName: <bu0001a0008-00-example-com-tls-secret>
rules:
- host: bu0001a0008-00.aks-ingress.contoso.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: aspnetapp-service
port:
number: 80
---