-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathserver.yaml
More file actions
97 lines (93 loc) · 2.36 KB
/
Copy pathserver.yaml
File metadata and controls
97 lines (93 loc) · 2.36 KB
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
apiVersion: apps/v1
kind: Deployment
metadata:
name: server
spec:
selector:
matchLabels:
app: server
replicas: 2
template:
metadata:
labels:
app: server
spec:
serviceAccountName: cloudsql-service-account
containers:
- name: server
image: server:latest
envFrom:
- secretRef:
name: application-config
readinessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 5
periodSeconds: 3
livenessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 5
periodSeconds: 10
resources:
requests:
memory: 300Mi
cpu: 50m
limits:
memory: 1000Mi
cpu: 500m
# FIXME resource limits for cloud sql proxy
# https://github.com/GoogleCloudPlatform/cloudsql-proxy/issues/103
- name: cloud-sql-proxy
image: gcr.io/cloudsql-docker/gce-proxy:1.20.2
env:
- name: CLOUDSQL_INSTANCE
valueFrom:
secretKeyRef:
name: application-config
key: CLOUDSQL_INSTANCE
command:
- '/cloud_sql_proxy'
# Terraform creates the cloud sql instance and stores the connection
# information in a kubernetes secret
# We read the instance name from this secret and pass it to the
# cloud_sql_proxy command here:
- '-instances=$(CLOUDSQL_INSTANCE)=tcp:3306'
securityContext:
runAsNonRoot: true
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: cloud.google.com/gke-preemptible
operator: Exists
weight: 100
---
apiVersion: v1
kind: Service
metadata:
name: server
spec:
selector:
app: server
ports:
- name: ws
port: 3000
targetPort: 3000
type: NodePort
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: server
spec:
scaleTargetRef:
apiVersion: apps/v1beta1
kind: Deployment
name: server
minReplicas: 2
maxReplicas: 5
targetCPUUtilizationPercentage: 75