I have one port specified as below.
my-app-service.yaml
apiVersion: v1
kind: Service
metadata:
labels:
app: my-app
name: my-app-service
namespace: default
spec:
externalTrafficPolicy: Cluster
ports:
- port: 80
name: my-port
protocol: TCP
targetPort: 8000
selector:
app: my-app
sessionAffinity: None
type: NodePort
cloudbuild.yaml summary:
steps:
- name: gcr.io/cloud-builders/gcloud
- name: gcr.io/cloud-builders/docker
- name: gcr.io/cloud-builders/gke-deploy
For some reason I get an error asking for a name param on port1, when port1 doesn't even exist. See below.
output:
Step #3: Applying deployment.
Step #3: Getting access to cluster "my-cluster" in "my-zone".
Step #3: Configuration files to be used: [{kind: Deployment, name: my-app} {kind: HorizontalPodAutoscaler, name: my-app-hpa} {kind: Service, name: my-app-service}]
Step #3: Applying configuration files to cluster.
Step #3: Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
Step #3: The Service "my-app-service" is invalid:
Step #3: * spec.ports[1].name: Required value
Kubernetes version: 1.15.9-gke.24
Anyone know what I'm missing?
Recreating the yaml worked:
kubectl delete -f service.yaml
kubectl apply -f service.yaml