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 這里的配置改成數組就可以了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM