-
Notifications
You must be signed in to change notification settings - Fork 0
/
fib.yaml
57 lines (57 loc) · 1.28 KB
/
fib.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
apiVersion: apps/v1
kind: Deployment
metadata:
name: fibonacci-api-deployment
spec:
replicas: 1
selector:
matchLabels:
app: fibonnaci-api
template:
metadata:
labels:
app: fibonnaci-api
spec:
containers:
- name: fibonnaci-api
image: evandrosouza89/fibonnaci-api:latest
# Vertical scaling
resources:
requests:
cpu: "200m" # Request 200 milliCPU for this container
memory: "256Mi"
limits:
cpu: "500m" # Limit to 500 milliCPU for this container
memory: "512Mi"
---
apiVersion: v1
kind: Service
metadata:
name: fibonacci-api-service
spec:
selector:
app: fibonnaci-api
ports:
- protocol: TCP
port: 8080
targetPort: 8080
type: LoadBalancer
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: fibonacci-api-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: fibonacci-api-deployment
minReplicas: 1 # Minimum number of replicas
maxReplicas: 3 # Maximum number of replicas
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80 # Target average CPU utilization percentage