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