kubernetes Dapr侧车进样器日志显示应用侧车限值时出现正则表达式错误

ovfsdjhp  于 2022-12-22  发布在  Kubernetes
关注(0)|答案(1)|浏览(103)

我想部署一个对边车有限制的Dapr应用程序

annotations:
        dapr.io/enabled: "true"
        dapr.io/app-id: "simple-js"
        dapr.io/app-port: "5001"
        dapr.io/sidecar-cpu-limit: “200m”
        dapr.io/sidecar-cpu-request: “100m”
        dapr.io/sidecar-memory-limit: “200Mi”
        dapr.io/sidecar-memory-request: “100Mi”

但得到以下错误消息:
time=“2022-12- 18 T15:57:52.123897777Z”level=警告消息=“无法设置容器资源需求:解析边车cpu限制时出错:数量必须与正则表达式'^([+-]?[0-9.]+)([eEinumkKMGTP][-+]?[0-9])$'匹配。使用默认值”示例= dapr-sidecar-injector-858 f7757 f8 -6dzdq范围=dapr.injector.容器类型=日志版本=1.9.5
time=“2022-12- 18 T16:07:57.422789042Z”level=警告消息=“无法设置容器资源需求:解析边车内存限制时出错:数量必须与正则表达式'^([+-]?[0-9.]+)([eEinumkKMGTP][-+]?[0-9])$'匹配。使用默认值”示例= dapr-边车-注射器-858 f7757 f8 -6dzdq范围=dapr.注射器.容器类型=日志版本=1.9.5

wooyq4lh

wooyq4lh1#

新手错误。原来在组装来自https://docs.dapr.io/operations/hosting/kubernetes/kubernetes-production/#sidecar-resource-settings和/或建议的https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/#create-a-pod的注解时,我引入了特殊字符/双引号,在我的编辑器中无法区分(VS Code with my fancy 3270 Nerdfont):

annotations:
        dapr.io/enabled: "true"
        dapr.io/app-id: "simple-js"
        dapr.io/app-port: "5001"
        dapr.io/sidecar-cpu-limit: “200m”
        dapr.io/sidecar-cpu-request: “100m”
        dapr.io/sidecar-memory-limit: “200Mi”
        dapr.io/sidecar-memory-request: “100Mi”

用正确的双引号替换损坏的双引号修复了问题

annotations:
        dapr.io/enabled: "true"
        dapr.io/app-id: "simple-js"
        dapr.io/app-port: "5001"
        dapr.io/sidecar-cpu-limit: "200m"
        dapr.io/sidecar-cpu-request: "100m"
        dapr.io/sidecar-memory-limit: "200Mi"
        dapr.io/sidecar-memory-request: "100Mi"

现在,使用kubectl描述pod时也会显示限制

Limits:
      cpu:     200m
      memory:  200Mi
    Requests:
      cpu:      100m
      memory:   100Mi

相关问题