new file: akashop/hpa.yml

This commit is contained in:
Sangmin Kim 2024-04-26 16:55:41 +09:00
parent 3d3794013f
commit b194736d7c
4 changed files with 49 additions and 13 deletions

View File

@ -4,7 +4,7 @@ metadata:
name: wp
namespace: akashop
spec:
replicas: 3
replicas: 1
selector:
matchLabels:
app: wp
@ -19,11 +19,11 @@ spec:
imagePullPolicy: Always
resources:
limits:
cpu: "2"
memory: "2Gi"
requests:
cpu: "1"
memory: "1Gi"
requests:
cpu: "0.5"
memory: "200Mi"
ports:
- name: http
containerPort: 80
@ -41,12 +41,12 @@ spec:
# secretKeyRef:
# name: my-secret # Name of the secret containing the variable
# key: VAR2_KEY
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
periodSeconds: 10
#livenessProbe:
#httpGet:
#path: /
#port: 80
#initialDelaySeconds: 5
#periodSeconds: 10
volumeMounts:
- name: wp-data
mountPath: /var/www/html
@ -78,8 +78,8 @@ spec:
imagePullPolicy: Always
resources:
limits:
cpu: "1"
memory: "1Gi"
cpu: "2"
memory: "2Gi"
requests:
cpu: "0.5"
memory: "200Mi"

19
akashop/hpa.yml Normal file
View File

@ -0,0 +1,19 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: wp-hpa
namespace: akashop
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: wp
minReplicas: 1
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50

View File

@ -1,3 +1,15 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: akashop-ratelimit
namespace: akashop
spec:
rateLimit:
average: 5
burst: 10
---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
@ -27,7 +39,8 @@ spec:
- name: wp
port: 80
# middlewares:
middlewares:
- name: akashop-ratelimit
# - name: akashop-redir
---
@ -60,3 +73,6 @@ spec:
# strategy: RoundRobin
# weight: 10
# nativeLB: true
middlewares:
- name: akashop-ratelimit

View File

@ -2,6 +2,7 @@ kind: Deployment
apiVersion: apps/v1
metadata:
name: traefik-deployment
namespace: traefik
labels:
app: traefik