-
Notifications
You must be signed in to change notification settings - Fork 1
/
bucket-api-template.yaml
105 lines (105 loc) · 2.14 KB
/
bucket-api-template.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
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: bucket-api
namespace: bucket-api-ns
annotations:
app: 'bucket-api'
spec:
replicas: 2
selector:
matchLabels:
app: bucket-api
template:
metadata:
labels:
app: bucket-api
spec:
serviceAccountName: bucket-api-ksa
containers:
- name: bucket-api
image: gcr.io/<project-id>/bucket-api:latest
imagePullPolicy: Always
env:
- name: GCS_BUCKET_NAME
value: "<project-id>-bucket-api"
ports:
- containerPort: 8000
resources:
requests:
cpu: "0.25"
memory: "256Mi"
---
apiVersion: v1
kind: Service
metadata:
name: bucket-api
namespace: bucket-api-ns
annotations:
app: 'bucket-api'
cloud.google.com/neg: '{"ingress": true}'
cloud.google.com/backend-config: '{"default": "bucket-api-backend-config"}'
spec:
selector:
app: bucket-api
type: ClusterIP
ports:
- port: 8000
targetPort: 8000
protocol: TCP
---
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: 'bucket-api-hpa'
namespace: bucket-api-ns
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: 'bucket-api'
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: "bucket-api-ingress"
namespace: bucket-api-ns
annotations:
app: 'bucket-api'
kubernetes.io/ingress.class: gce
spec:
rules:
- http:
paths:
- path: /*
pathType: ImplementationSpecific
backend:
service:
name: bucket-api
port:
number: 8000
---
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: bucket-api-backend-config
namespace: bucket-api-ns
spec:
healthCheck:
checkIntervalSec: 10
timeoutSec: 10
healthyThreshold: 1
unhealthyThreshold: 3
port: 8000
type: HTTP
requestPath: /ping