forked from lukerops/ufes-posts-microservice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.yaml
163 lines (162 loc) · 3.05 KB
/
deploy.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
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: posts-mysql-data
namespace: ufes
spec:
storageClassName: standard-rwx
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: posts-mysql
namespace: ufes
labels:
app: posts-mysql
spec:
selector:
matchLabels:
app: posts-mysql
replicas: 1
template:
metadata:
labels:
app: posts-mysql
spec:
containers:
- name: posts-mysql
image: mysql:8.0
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 500m
memory: 512Mi
env:
- name: MYSQL_ROOT_PASSWORD
value: password
- name: MYSQL_DATABASE
value: posts
- name: MYSQL_USER
value: post_microsservice
- name: MYSQL_PASSWORD
value: password
ports:
- containerPort: 80
name: posts-mysql
volumeMounts:
- name: mysql-data
mountPath: /var/lib/mysql
volumes:
- name: mysql-data
persistentVolumeClaim:
claimName: posts-mysql-data
---
apiVersion: v1
kind: Service
metadata:
name: posts-mysql
namespace: ufes
spec:
selector:
app: posts-mysql
type: ClusterIP
ports:
- name: posts-mysql
protocol: TCP
port: 3306
targetPort: 3306
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: posts
namespace: ufes
labels:
app: posts
spec:
selector:
matchLabels:
app: posts
replicas: 1
template:
metadata:
labels:
app: posts
spec:
containers:
- name: posts
image: ghcr.io/lukerops/ufes-posts-microservice:latest
imagePullPolicy: Always
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 500m
memory: 512Mi
env:
- name: DB_URL
value: jdbc:mysql://posts-mysql.ufes.svc.cluster.local:3306/posts
ports:
- containerPort: 8081
name: http
---
apiVersion: v1
kind: Service
metadata:
name: posts
namespace: ufes
spec:
selector:
app: posts
type: ClusterIP
ports:
- name: posts
protocol: TCP
port: 8081
targetPort: 8081
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: posts-ufes-tls
namespace: ufes
spec:
secretName: posts-ufes-tls-certificate
issuerRef:
kind: ClusterIssuer
name: ybatinga
dnsNames:
- posts-ufes.ybatinga.com.br
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: posts
namespace: ufes
spec:
ingressClassName: ybatinga-ingress
rules:
- host: posts-ufes.ybatinga.com.br
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: posts
port:
number: 8081
tls:
- hosts:
- posts-ufes.ybatinga.com.br
secretName: posts-ufes-tls-certificate
---