I was following this tutorial https://www.cloudbooklet.com/kubernetes-basic-php-application-with-nginx-on-google-cloud/ and when I got to this command kubectl apply -f php_service.yaml --validate=false
this error popped up:
The Service "php" is invalid: spec.ports: Required value.
How do I fix this? This is the yaml file:
apiVersion: v1
kind: Service
metadata:
name: php
labels:
tier: backend
spec:
selector:
app: php
tier: backend
ports:
protocol: TCP
port: 9000
Your syntax is wrong. Protocol and port should be items from the spec.ports
field. It should look something like this