You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Google Cloud Deploy部署至Cloud Run时CPU节流配置异常

解决Google Cloud Deploy中Cloud Run Worker服务CPU节流参数不生效问题

针对worker-staging服务run.googleapis.com/cpu-throttling参数未按预期设为true的问题,可按以下步骤排查修复:

1. 核对Skaffold参数与模板引用

确保在skaffold.yaml中为worker服务单独定义CPU节流参数,避免与api服务共用:

profiles:
  - name: staging
    deploy:
      cloudrun:
        params:
          - name: api-cpu-throttling
            value: "false"
          - name: worker-cpu-throttling
            value: "true"

同时检查ops/staging.yaml中worker服务的注释是否正确引用对应参数,用squote确保字符串被正确包裹:

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: worker-staging
  annotations:
    run.googleapis.com/cpu-throttling: '{{.Values.worker-cpu-throttling | squote}}'

2. 本地验证Skaffold渲染结果

直接执行本地渲染命令,查看生成的manifest是否正确替换参数:

skaffold render --profile staging

如果生成的worker-staging配置中cpu-throttling仍为false,说明参数绑定逻辑有误;若为true,则问题出在Cloud Deploy的参数传递环节。

3. 检查Cloud Deploy配置

确认clouddeploy.yaml中两个target都正确指定了staging profile,确保参数能被正确传递:

targets:
  - targetId: staging-api
    location: us-central1
    executionConfigs:
      - usages: ["DEPLOY"]
        skaffoldConfig: skaffold.yaml
        profile: staging
  - targetId: staging-worker
    location: us-central1
    executionConfigs:
      - usages: ["DEPLOY"]
        skaffoldConfig: skaffold.yaml
        profile: staging

4. 排查YAML语法与版本问题

  • 检查ops/staging.yaml中worker服务的注释部分是否存在缩进错误或引号使用不当,错误的YAML语法会导致参数替换失效。
  • 升级Skaffold至最新稳定版,旧版本可能存在参数替换的已知bug:
skaffold upgrade

5. 验证最终部署配置

部署完成后,通过gcloud命令确认worker服务的实际配置:

gcloud run services describe worker-staging --region us-central1

对比生成的manifest与实际部署的注释,定位参数丢失的环节。

内容的提问来源于stack exchange,提问作者Tom Pesman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 12:33:13