-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser-service-deployment.yaml
86 lines (82 loc) · 1.98 KB
/
user-service-deployment.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
---
apiVersion: v1
kind: Service
metadata:
name: user-service
spec:
selector:
app: user-service
ports:
- protocol: TCP
# use the default port simplify FeignClient configuration
port: 80
targetPort: 9004
---
# Reference: https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/
apiVersion: apps/v1
kind: Deployment
metadata:
name: userservice-deployment
spec:
selector:
matchLabels:
app: user-service
replicas: 1 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: user-service
spec:
containers:
- name: user-service
image: user-service:0.0.1
# https://iximiuz.com/en/posts/kubernetes-kind-load-docker-image/
# https://kubernetes.io/docs/concepts/containers/images/#updating-images
imagePullPolicy: Never
ports:
- containerPort: 9004
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "500m"
---
# Reference: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: php-apache
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: userservice-deployment
minReplicas: 1
maxReplicas: 2
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
# - type: Pods
# pods:
# metric:
# name: packets-per-second
# target:
# type: AverageValue
# averageValue: 0.5k
# - type: Object
# object:
# metric:
# name: requests-per-second
# describedObject:
# apiVersion: networking.k8s.io/v1
# kind: Ingress
# name: main-route
# target:
# type: Value
# value: 10