gabriele locatelli
gabriele locatelli

Reputation: 11

error while doing "kubectl apply -f ..." apiVersion v1?

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

Upvotes: 1

Views: 596

Answers (1)

Cavaz
Cavaz

Reputation: 3119

that would be a simple typo. You defined ports: 3050 instead of port: 3050

Upvotes: 2

Related Questions