-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathk8s-master.yaml
165 lines (158 loc) · 4.33 KB
/
k8s-master.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
163
164
165
---
apiVersion: 'apps/v1'
kind: 'Deployment'
metadata:
name: 'rnkm63-backend'
labels:
app: 'rnkm63-backend'
spec:
replicas: 1
selector:
matchLabels:
app: 'rnkm63-backend'
template:
metadata:
labels:
app: 'rnkm63-backend'
spec:
containers:
- name: 'rnkm63-backend'
image: 'gcr.io/rnkm63/backend:master'
env:
# App port
- name: PORT
value: '3000'
# Postgres
- name: DATABASE_HOST
valueFrom:
secretKeyRef:
name: backend-secrets
key: db_host
- name: DATABASE_PORT
valueFrom:
secretKeyRef:
name: backend-secrets
key: db_port
- name: DATABASE_NAME
valueFrom:
secretKeyRef:
name: backend-secrets
key: db_name
- name: DATABASE_USERNAME
valueFrom:
secretKeyRef:
name: backend-secrets
key: db_username
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: backend-secrets
key: db_password
# InfluxDB
- name: INFLUXDB_URL
valueFrom:
secretKeyRef:
name: backend-secrets
key: influxdb_url
- name: INFLUXDB_ORG
valueFrom:
secretKeyRef:
name: backend-secrets
key: influxdb_org
- name: INFLUXDB_BUCKET
valueFrom:
secretKeyRef:
name: backend-secrets
key: influxdb_bucket
- name: INFLUXDB_TOKEN
valueFrom:
secretKeyRef:
name: backend-secrets
key: influxdb_token
# Chula SSO
- name: SSO_URL
valueFrom:
secretKeyRef:
name: backend-secrets
key: sso_url
- name: SSO_APPID
valueFrom:
secretKeyRef:
name: backend-secrets
key: sso_appid
- name: SSO_APPSECRET
valueFrom:
secretKeyRef:
name: backend-secrets
key: sso_appsecret
# JWT Secret
- name: JWT_SECRET
valueFrom:
secretKeyRef:
name: backend-secrets
key: jwt_secret
- name: JWT_EXPIRES
value: 7d
# Cookie Secure
- name: COOKIE_SECURE
value: 'true'
# GCS credentials
- name: KEY_FILE_PATH
value: /etc/secrets/gsa_key
- name: PROJECT_ID
valueFrom:
secretKeyRef:
name: backend-secrets
key: gcp_project_id
- name: BUCKET_NAME
valueFrom:
secretKeyRef:
name: backend-secrets
key: gcs_bucket_name
- name: IMG_FILE_NAME_SECRET
valueFrom:
secretKeyRef:
name: backend-secrets
key: img_file_name_secret
# CORS
- name: USE_CORS
value: 'false'
volumeMounts:
- name: secrets
mountPath: '/etc/secrets'
readOnly: true
livenessProbe:
httpGet:
path: /api
port: 3000
initialDelaySeconds: 3
periodSeconds: 3
resources:
requests:
cpu: 500m
volumes:
- name: secrets
secret:
secretName: backend-secrets
items:
- key: gsa_key
path: gsa_key
---
apiVersion: 'autoscaling/v2beta1'
kind: 'HorizontalPodAutoscaler'
metadata:
name: 'rnkm63-backend-hpa-yptr'
labels:
app: 'rnkm63-backend'
spec:
scaleTargetRef:
kind: 'Deployment'
name: 'rnkm63-backend'
apiVersion: 'apps/v1'
minReplicas: 1
maxReplicas: 5
metrics:
- type: 'Resource'
resource:
name: 'cpu'
targetAverageUtilization: 80