为什么下面的k8s命令语法错误?



我在k8s中使用以下语法,错误是返回错误

spec:
containers:
- args:
- sleep
- 36000

错误:Error from server (BadRequest): error when creating "tomcat.pod": Pod in version "v1" cannot be handled as a Pod: v1.Pod.Spec: v1.PodSpec.Containers: []v1.Container: v1.Container.Args: []string: ReadString: expects " or n, but found 3, error found in #10 byte of ...|["sleep",36000],"ima|..., bigger context ...|perator"},"spec":{"containers":[{"args":["sleep",36000],"image":"harbor.test.local/test/tomcat:8.5",|...

this is ok

spec:
containers:
- args:
- "sleep 36000"

YAML尝试为每个标量节点分配类型。args:需要是一个字符串列表,但36000被解析为一个数字。解决这个问题的最简单方法是将数值用单引号或双引号括起来。

args:
- sleep
- '36000'

nulltruefalse也被解析为非字符串类型,也需要加引号。

相关内容

  • 没有找到相关文章

最新更新