Odigos 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
来自真实用户的反馈,见证轩辕镜像的优质服务
免费版仅支持 Docker Hub 加速,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
免费版仅支持 docker.io;专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像加速服务
在 Docker Desktop 配置镜像加速
Docker Compose 项目配置加速
Kubernetes 集群配置 Containerd
在宝塔面板一键配置镜像加速
Synology 群晖 NAS 配置加速
飞牛 fnOS 系统配置镜像加速
极空间 NAS 系统配置加速服务
爱快 iKuai 路由系统配置加速
绿联 NAS 系统配置镜像加速
QNAP 威联通 NAS 配置加速
Podman 容器引擎配置加速
HPC 科学计算容器配置加速
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名加速
需要其他帮助?请查看我们的 常见问题 或 官方QQ群: 13763429