我是一个初学者,开始学习Kubernetes。
我正在尝试创建一个名为myfirstpodwithlabels.yaml的POD,并在我的YAML文件中编写以下规范。但是,当我尝试创建POD时,会出现此错误。
error: error validating "myfirstpodwithlabels.yaml": error validating data: [ValidationError(Pod.spec): unknown field "contianers" in io.k8s.api.core.v1.PodSpec, ValidationError(Pod.spec): missing required field "containers" in io.k8s.api.core.v1.PodSpec]; if you choose to ignore these errors, turn validation off with --validate=false
我的YAML文件规范
kind: Pod
apiVersion: v1
metadata:
name: myfirstpodwithlabels
labels:
type: backend
env: production
spec:
contianers:
- image: aamirpinger/helloworld:latest
name: container1
ports:
- containerPort: 80
答案 0 :(得分:1)
在Yaml的.spec部分中有一个错字。 你写了:
在错误消息中应有的显示
也供以后参考:如果您的资源定义yaml中存在问题,则可以将yaml实际发布到stackoverflow上,否则会有所帮助。