问题:

[root@master01 yaml]# kubectl apply -f xxx.yaml 
service/bse-nsq created
Error from server (BadRequest): error when creating "xxx.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 6, error found in #10 byte of ...|,"value":5800}],"ima|..., bigger context ..."},{"name":"server.port","value":5800}],"image":"xxxx|...

解决

在k8s中,如果 Deployment 中使用了 env,并且 env 中有一些值是数字,就会抛出这个错误,解决办法就是将数字添加引号
eg:

	env:
	-name: server.port
	 value: "5800"    
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐