Kubectl 创建 Deployment 错误 Deployment in version "v1" cannot be handled as a Deployment.....

在创建 Deployment 时抛出了下面的错误。

[root@node4 api]# kubectl apply -f api.yaml
Error from server (BadRequest): error when creating “beyondapi-api.yaml”: Deployment in version “v1” cannot be handled as a Deployment: v1.Deployment.Spec: v1.DeploymentSpec.Template: v1.PodTemplateSpec.Spec: v1.PodSpec.Containers: []v1.Container: v1.Container.Env: []v1.EnvVar: v1.EnvVar.Value: ReadString: expects " or n, but found 8, error found in #10 byte of …|,“value”:8848},{“nam|…, bigger context …|ntainers”:[{“env”:[{“name”:“SERVER_PORT”,“value”:8848},{“name”:“DATASOURCE_USERNAME”,“value”:“root”}|…
解决:如果 Deployment 中使用了 env,并且 env 中有一些值是数字,就会抛出这个错误,解决办法就是将数字添加引号,类似下面截图中内容。

 

Kubectl 创建 Deployment 错误 Deployment in version "v1" cannot be handled as a Deployment.....

 

上一篇:client-go实战之三:Clientset


下一篇:FLINK基础(152): RUNTIME(4)Flink on Yarn/K8s 原理剖析及实践(3)Flink on Kubernetes 原理剖析