英文:
error while doing "kubectl apply -f ..." apiVersion v1?
问题
错误:
>来自服务器的错误(BadRequest):在创建“client-node-port.yaml”时出现错误:无法将版本“v1”中的Service视为Service:严格解码错误:未知字段“spec.ports[0].ports”
apiVersion: v1
kind: Service
metadata:
name: client-node-port
spec:
type: NodePort
ports:
- ports: 3050
targetPort: 3000
nodePort: 31515
selector:
component: web
这是文件“client-node-port.yaml”,我还有一个名为“client-pod.yaml”的文件,其中 kind: pod
。
英文:
the error:
>Error from server (BadRequest): error when creating "client-node-port.yaml": Service in version "v1" cannot be handled as a Service: strict decoding error: unknown field "spec.ports[0].ports"
apiVersion: v1
kind: Service
metadata:
name: client-node-port
spec:
type: NodePort
ports:
- ports: 3050
targetPort: 3000
nodePort: 31515
selector:
component: web
this is the file "client-node-port.yaml", I also have a file named "client-pod.yaml" that is kind: pod
答案1
得分: 1
这可能只是一个简单的拼写错误。您定义了ports: 3050
而不是port: 3050
。
英文:
that would be a simple typo. You defined ports: 3050
instead of port: 3050
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论