Skip to content

Commit

Permalink
インフラこねた
Browse files Browse the repository at this point in the history
  • Loading branch information
na2na-p committed Jun 9, 2024
1 parent 2a967a6 commit b8e2f0e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 15 deletions.
26 changes: 22 additions & 4 deletions infra/k8s/web/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.hpa.enabled -}}
apiVersion: autoscaling/v1
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "web.fullname" . }}
Expand All @@ -8,10 +8,28 @@ metadata:
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: StatefulSet
kind: ReplicaSet
name: {{ include "web.fullname" . }}
minReplicas: {{ .Values.hpa.minReplicas }}
maxReplicas: {{ .Values.hpa.maxReplicas }}
targetCPUUtilizationPercentage: {{ .Values.hpa.targetCPUUtilizationPercentage }}
# targetMemoryUtilizationPercentage: {{ .Values.hpa.targetMemoryUtilizationPercentage }} # 必要に応じてコメントアウトを解除
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.hpa.targetCPUUtilizationPercentage }}
behavior:
scaleUp:
policies:
- type: Pods
value: 2
periodSeconds: 60
stabilizationWindowSeconds: 300
scaleDown:
policies:
- type: Pods
value: 2
periodSeconds: 60
stabilizationWindowSeconds: 300
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
apiVersion: apps/v1
kind: StatefulSet
kind: ReplicaSet
metadata:
name: {{ include "web.fullname" . }}
labels:
{{- include "web.labels" . | nindent 4 }}
spec:
serviceName: "web"
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "web.selectorLabels" . | nindent 6 }}
Expand All @@ -23,8 +21,21 @@ spec:
- containerPort: 3000
readinessProbe:
httpGet:
path: /
path: /healthz
port: 3000
livenessProbe:
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
httpGet:
path: /healthz
port: 3000
resources:
requests:
cpu: {{ .Values.resources.requests.cpu }}
memory: {{ .Values.resources.requests.memory }}
limits:
cpu: {{ .Values.resources.limits.cpu }}
memory: {{ .Values.resources.limits.memory }}
volumeMounts:
- mountPath: /misskey/.config
name: misskey-default-conf-file
Expand Down
21 changes: 14 additions & 7 deletions infra/k8s/web/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
replicaCount: 2

image:
repository: na2na/misskey-na2na
tag: "2023.11.1-na2na-v4"
Expand All @@ -22,8 +20,6 @@ service:
port: 3000
nodePort: 30000

resources: {}

nodeSelector: {}

tolerations: []
Expand All @@ -33,7 +29,18 @@ affinity: {}
# HPAの設定
hpa:
enabled: true
minReplicas: 1
maxReplicas: 3
minReplicas: 2
maxReplicas: 5
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80 # 必要に応じてコメントアウトを解除

resources:
requests:
cpu: 200m
memory: 1Gi
limits:
cpu: 1024m
memory: 2Gi

livenessProbe:
initialDelaySeconds: 60
periodSeconds: 10

0 comments on commit b8e2f0e

Please sign in to comment.