设置ECI Pod的故障处理策略 配置示例 以下示例创建一个故障处理策略为failfast的实例。当实例因库存不足创建失败时,系统直接返回失败,不再重试。 shell { "containerGroupName": "testfailstrategy", "cpu": 1, "memory": 2, "annotations": { "k8s.ctyun.cn/ecifailstrategy": "failfast" }, "containers": [ { "name": "nginx", "image": "nginx:latest" } ] } 通过 Kubernetes 工作负载创建时,注解的放置方式如下: shell apiVersion: apps/v1 kind: Deployment metadata: name: test spec: replicas: 1 selector: matchLabels: app: test template: metadata: labels: app: test annotations: k8s.ctyun.cn/ecifailstrategy: "failfast" 创建失败后直接报错,不再重试 spec: containers: name: nginx image: nginx:latest 结果验证 实例创建后,可通过查询接口查看实例状态。与故障处理策略相关的字段如下: 字段 含义 status.failStrategy 实际生效的策略,取值为failback、failover或 failfast status.retryTimes 当前策略下已重试的次数,用于运维与审计 status.retryDeadline 重试截止时间,首次重试时初始化。超过该时间后不再重试 status.lastScheduleError 最近一次调度失败的原因 status.phase 实例所处阶段。重试期间为Scheduling,失败终态为ScheduleFailed failback策略重试中的状态示例如下: shell { "status": { "phase": "Scheduling", "failStrategy": "failback", "retryTimes": 2, "retryDeadline": "20261102T10:20:00Z", "lastScheduleError": "FlavorSoldOut: the specified flavor is out of stock" } } failfast策略创建失败后的状态示例如下: shell { "status": { "phase": "ScheduleFailed", "failStrategy": "failfast", "retryTimes": 0, "lastScheduleError": "FlavorSoldOut: the specified flavor is out of stock" } }