在创建 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 中有一些值是数字,就会抛出这个错误,解决办法就是将数字添加引号,类似下面截图中内容。