
keyval/odigos-autoscalerOdigos Autoscaler Service镜像是Odigos项目的核心组件之一,专注于实现服务的自动扩缩容功能。该镜像通过监控服务负载指标(如CPU、内存使用率)或自定义业务指标,动态调整服务实例数量,从而在保障服务性能稳定的同时,最大化资源利用率。
通过以下命令快速启动容器:
bashdocker run -d \ --name odigos-autoscaler \ -p 8080:8080 \ -e SCALING_POLICY=default \ -e MIN_REPLICAS=2 \ -e MAX_REPLICAS=10 \ -e METRIC_PROVIDER=prometheus \ -e PROMETHEUS_ENDPOINT=[***] \ -v /path/to/local/config:/etc/odigos/autoscaler \ odigos/autoscaler:latest
| 环境变量 | 描述 | 默认值 |
|---|---|---|
SCALING_POLICY | 扩缩容策略名称(对应配置文件) | default |
MIN_REPLICAS | 最小实例数 | 1 |
MAX_REPLICAS | 最大实例数 | 5 |
METRIC_PROVIDER | 指标数据源类型(如prometheus) | prometheus |
PROMETHEUS_ENDPOINT | Prometheus服务地址(当使用Prometheus时必填) | - |
COOLDOWN_SCALE_UP | 扩容冷却时间(秒) | 300 |
COOLDOWN_SCALE_DOWN | 缩容冷却时间(秒) | 600 |
TARGET_CPU_USAGE | CPU使用率目标阈值(百分比) | 70 |
TARGET_MEM_USAGE | 内存使用率目标阈值(百分比) | 80 |
yamlversion: '3.8' services: odigos-autoscaler: image: odigos/autoscaler:latest container_name: odigos-autoscaler ports: - "8080:8080" environment: - SCALING_POLICY=ecommerce - MIN_REPLICAS=3 - MAX_REPLICAS=15 - METRIC_PROVIDER=prometheus - PROMETHEUS_ENDPOINT=[***] - COOLDOWN_SCALE_UP=180 - COOLDOWN_SCALE_DOWN=300 volumes: - ./autoscaler-config:/etc/odigos/autoscaler restart: unless-stopped depends_on: - prometheus prometheus: image: prom/prometheus:latest volumes: - ./prometheus-config:/etc/prometheus ports: - "9090:9090"
通过挂载配置文件目录(如/etc/odigos/autoscaler),可定义精细化扩缩容策略(YAML格式),示例ecommerce.yaml:
yamlpolicy: name: ecommerce scaleUpRules: - metric: http_requests_per_second threshold: 1000 scaleBy: 2 evaluationPeriods: 3 - metric: cpu_usage threshold: 85 scaleBy: 1 evaluationPeriods: 2 scaleDownRules: - metric: http_requests_per_second threshold: 200 scaleBy: 1 evaluationPeriods: 5 cooldown: scaleUp: 180s scaleDown: 300s
在Kubernetes集群中,可通过Deployment部署并结合ConfigMap管理策略配置:
yamlapiVersion: apps/v1 kind: Deployment metadata: name: odigos-autoscaler namespace: odigos spec: replicas: 1 selector: matchLabels: app: odigos-autoscaler template: metadata: labels: app: odigos-autoscaler spec: containers: - name: odigos-autoscaler image: odigos/autoscaler:latest ports: - containerPort: 8080 env: - name: SCALING_POLICY value: "ecommerce" - name: KUBERNETES_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace volumeMounts: - name: policy-config mountPath: /etc/odigos/autoscaler volumes: - name: policy-config configMap: name: odigos-scaling-policies --- apiVersion: v1 kind: ConfigMap metadata: name: odigos-scaling-policies namespace: odigos data: ecommerce.yaml: | policy: name: ecommerce scaleUpRules: - metric: http_requests_per_second threshold: 1000 scaleBy: 2 scaleDownRules: - metric: http_requests_per_second threshold: 200 scaleBy: 1




manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务