Skip to content

Commit

Permalink
apps: cluster1: kubernetes-dashboard: Scale to zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
wigust committed Oct 19, 2023
1 parent 0d863c9 commit da6fe0b
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
16 changes: 16 additions & 0 deletions apps/cluster1/kubernetes-dashboard/httpscaledobject.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
kind: HTTPScaledObject
apiVersion: http.keda.sh/v1alpha1
metadata:
name: kubernetes-dashboard-web
spec:
host: kubernetes-dashboard.home.wugi.info
# Optional. Default: 300 seconds.
# Should be smaller than kubernetes-dashboard-web-scaledobject.
scaledownPeriod: 150
scaleTargetRef:
deployment: kubernetes-dashboard-web
service: kubernetes-dashboard-web
port: 8000
replicas:
min: 0
max: 1
2 changes: 2 additions & 0 deletions apps/cluster1/kubernetes-dashboard/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Kustomization
namespace: kubernetes-dashboard
resources:
- ../../base/kubernetes-dashboard
- scaledobject.yaml
- httpscaledobject.yaml
patchesStrategicMerge:
- release.yaml
configMapGenerator:
Expand Down
38 changes: 38 additions & 0 deletions apps/cluster1/kubernetes-dashboard/scaledobject.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: kubernetes-dashboard-web-scaledobject
spec:
maxReplicaCount: 1
minReplicaCount: 0
pollingInterval: 3 # Optional. Default: 30 seconds
cooldownPeriod: 300 # Optional. Default: 300 seconds
scaleTargetRef:
name: kubernetes-dashboard-web
triggers:
- type: prometheus
metadata:
serverAddress: http://kube-prometheus-stack-prometheus.monitoring:9090
metricName: nginx_ingress_controller_request_duration_seconds_count
threshold: "0.5"
query: max(irate(nginx_ingress_controller_request_duration_seconds_count{host="kubernetes-dashboard.home.wugi.info"}[5m]))
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: kubernetes-dashboard-api-scaledobject
spec:
maxReplicaCount: 1
minReplicaCount: 0
pollingInterval: 3 # Optional. Default: 30 seconds
cooldownPeriod: 300 # Optional. Default: 300 seconds
scaleTargetRef:
name: kubernetes-dashboard-api
triggers:
- type: prometheus
metadata:
serverAddress: http://kube-prometheus-stack-prometheus.monitoring:9090
metricName: nginx_ingress_controller_request_duration_seconds_count
threshold: "0.5"
query: max(irate(nginx_ingress_controller_request_duration_seconds_count{host="kubernetes-dashboard.home.wugi.info"}[5m]))
2 changes: 2 additions & 0 deletions apps/cluster1/kubernetes-dashboard/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# General configuration shared across resources
app:
ingress:
labels:
keda.cluster.local/scale-to-zero: "true"
hosts:
- kubernetes-dashboard.home.wugi.info
settings:
Expand Down

0 comments on commit da6fe0b

Please sign in to comment.