--- # HTTPScaledObject - 用于实现缩容到 0 的核心配置 apiVersion: http.keda.sh/v1alpha1 kind: HTTPScaledObject metadata: name: navigation-http-scaler namespace: navigation spec: hosts: - dh.u6.net3w.com pathPrefixes: - / scaleTargetRef: name: navigation kind: Deployment apiVersion: apps/v1 service: navigation port: 80 replicas: min: 0 # 空闲时缩容到 0 max: 10 # 最多 10 个副本 scalingMetric: requestRate: granularity: 1s targetValue: 100 # 每秒 100 个请求时扩容 window: 1m scaledownPeriod: 300 # 5 分钟无流量后缩容到 0 --- # Traefik IngressRoute - 将流量路由到 KEDA HTTP Add-on 的拦截器 # 注意:必须在 keda namespace 中才能引用该 namespace 的服务 apiVersion: traefik.io/v1alpha1 kind: IngressRoute metadata: name: navigation-ingress namespace: keda spec: entryPoints: - web routes: - match: Host(`dh.u6.net3w.com`) kind: Rule services: - name: keda-add-ons-http-interceptor-proxy port: 8080