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