-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.yaml
108 lines (108 loc) · 2.21 KB
/
nginx.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
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
# replicas: 1
revisionHistoryLimit: 0
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
sidecar.istio.io/inject: "true"
version: v1.76.0
spec:
containers:
- name: nginx
image: harbor.k-tech.cloud/msa/nginx:1
ports:
- containerPort: 80
- name: nginx-exporter
image: nginx/nginx-prometheus-exporter:0.11.0
args:
- -nginx.scrape-uri=http://127.0.0.1:80/stub_status
ports:
- containerPort: 9113
name: metrics
imagePullSecrets:
- name: docker-config-secret
---
apiVersion: v1
kind: Service
metadata:
name: nginx-service
annotations:
prometheus.io/scrape: 'true'
prometheus.io/path: '/metrics' # 필요에 따라 수정
prometheus.io/port: '9113' # 서비스의 메트릭 포트 번호
spec:
selector:
app: nginx
sidecar.istio.io/inject: "true"
ports:
- port: 80
name: http-nginx
- port: 9113
targetPort: 9113
name: metrics
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: nginx-gateway
annotations:
kubernetes.io/ingress.class: istio
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 443
name: https
protocol: HTTPS
hosts:
- www.k-tech.cloud
tls:
mode: SIMPLE
credentialName: nginx-secret
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: nginx-virtualservice
spec:
gateways:
- nginx-gateway
hosts:
- www.k-tech.cloud
http:
- match:
- uri:
prefix: /
route:
- destination:
host: nginx-service
port:
number: 80
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: nginx
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: nginx
minReplicas: 1
maxReplicas: 3
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80