Verified Commit d92877f8 authored by Tom-R Kvalvaag's avatar Tom-R Kvalvaag
Browse files

feat(k8s): Implemented horizontal pod autoscaling for deployment

parent 70ee330f
...@@ -70,7 +70,7 @@ metadata: ...@@ -70,7 +70,7 @@ metadata:
app.kubernetes.io/part-of: ${CI_PROJECT_NAME} app.kubernetes.io/part-of: ${CI_PROJECT_NAME}
app.kubernetes.io/managed-by: gitlab app.kubernetes.io/managed-by: gitlab
spec: spec:
replicas: 2 replicas: 1
selector: selector:
matchLabels: matchLabels:
app.kubernetes.io/instance: ${CI_PROJECT_NAME}-${CI_ENVIRONMENT_SLUG} app.kubernetes.io/instance: ${CI_PROJECT_NAME}-${CI_ENVIRONMENT_SLUG}
...@@ -105,3 +105,21 @@ spec: ...@@ -105,3 +105,21 @@ spec:
port: 80 port: 80
initialDelaySeconds: 10 initialDelaySeconds: 10
timeoutSeconds: 1 timeoutSeconds: 1
resources:
limits:
cpu: 300m
requests:
cpu: 200m
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: ${CI_PROJECT_NAME}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: ${CI_PROJECT_NAME}
minReplicas: 1
maxReplicas: 3
targetCPUUtilizationPercentage: 70
...@@ -98,3 +98,21 @@ spec: ...@@ -98,3 +98,21 @@ spec:
port: 80 port: 80
initialDelaySeconds: 10 initialDelaySeconds: 10
timeoutSeconds: 1 timeoutSeconds: 1
resources:
limits:
cpu: 200m
requests:
cpu: 100m
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: ${CI_PROJECT_NAME}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: ${CI_PROJECT_NAME}
minReplicas: 1
maxReplicas: 2
targetCPUUtilizationPercentage: 70
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment