-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkubernestes.deployment.yml
130 lines (128 loc) · 2.33 KB
/
kubernestes.deployment.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
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
apiVersion: v1
kind: Service
metadata:
name: nest-db
spec:
ports:
- name: postgres
port: 5432
targetPort: 5432
selector:
app: nest-db
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nest-db
spec:
replicas: 1
selector:
matchLabels:
app: nest-db
template:
metadata:
labels:
app: nest-db
spec:
containers:
- name: postgres
image: docker.io/postgres:latest
env:
- name: POSTGRES_USER
value: ${POSTGRES_USER}
- name: POSTGRES_PASSWORD
value: ${POSTGRES_PASSWORD}
- name: POSTGRES_DB
value: ${POSTGRES_DB}
ports:
- containerPort: 5432
volumeMounts:
- name: nest-db-storage
mountPath: /var/lib/postgresql/data
volumes:
- name: nest-db-storage
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: nest-api
spec:
ports:
- name: http
port: 3000
targetPort: 3000
selector:
app: nest-api
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nest-api
spec:
replicas: 1
selector:
matchLabels:
app: nest-api
template:
metadata:
labels:
app: nest-api
spec:
containers:
- name: nest-api
image: christrova/api-crud-nest
ports:
- containerPort: 3000
env:
- name: DATABASE_URL
value: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@nest-db:5432/${POSTGRES_DB}
---
apiVersion: v1
kind: Service
metadata:
name: redis
spec:
ports:
- name: redis
port: 3001
targetPort: 6379
selector:
app: redis
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: docker.io/redis:latest
ports:
- containerPort: 6379
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nest-api
spec:
rules:
- host: nest-api.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nest-api
port:
name: http