-
Notifications
You must be signed in to change notification settings - Fork 4
/
nginx.yml
74 lines (74 loc) · 1.77 KB
/
nginx.yml
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
apiVersion: v1
kind: Service
metadata:
name: svc-frontend
spec:
selector:
app: nginx
tier: frontend
ports:
- name: http
protocol: "TCP"
port: 80
targetPort: 5000
- name: https
protocol: "TCP"
port: 443
targetPort: 443
type: NodePort
# type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1 # Default is 1
selector:
matchLabels:
app: nginx # Has to match .spec.template.metadata.labels
tier: frontend
# track: stable
template:
metadata:
labels:
app: nginx # Has to match .spec.selector.matchLabels
tier: frontend
# track: stable
spec:
terminationGracePeriodSeconds: 10
containers:
- name: nginx
# image: k8s.gcr.io/nginx-slim:0.8
image: nginx:latest
lifecycle:
preStop:
exec:
command: ["/usr/sbin/nginx","-s","quit"]
ports:
- name: http
protocol: "TCP"
containerPort: 80
# hostPort: 8081
- name: https
protocol: "TCP"
containerPort: 443
# hostPort: 8082
volumeMounts:
- mountPath: /etc/nginx/nginx.conf # mount nginx-config volume to /etc/nginx
readOnly: true
name: nginx-config-volume
subPath: nginx.conf
- mountPath: /var/log/nginx
name: nginx-log-volume
volumes:
- name: nginx-config-volume
configMap:
name: nginx-config # place ConfigMap `nginx-conf` on /etc/nginx
items:
- key: nginx.config
path: nginx.conf
# - key: virtualhost.config
# path: virtualhost/virtualhost.conf # dig directory
- name: nginx-log-volume
emptyDir: {}