k8s创建deployment时出现错误ValidationError
作者:互联网
- error: error validating "service_deployment.yml": error validating data: ValidationError(Deployment.spec.template.spec.containers[0].ports): invalid type for io.k8s.api.core.v1.Container.ports: got "map", expected "array"; if you choose to ignore these errors, turn validation off with --validate=false
我们来看错误提示:
ValidationError(Deployment.spec.template.spec.containers[0].ports): invalid type for io.k8s.api.core.v1.Container.ports: got "map", expected "array";
Deployment.spec.template.spec.containers[0].ports表示 yaml 目录树出错的位置,在spec>template>spec>containers[0]>ports出现错误;
Container.ports: got "map", expected "array"表示,ports 这里期望的类型是数组,但得到的是字典;
所以,我们需要把 ports 这里的配置改成数组就可以了。
标签:map,Container,ValidationError,ports,template,deployment,k8s,spec,containers 来源: https://www.cnblogs.com/wufj/p/13195497.html