我有一个端口指定如下。
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
云构建. yaml摘要:
steps:
- name: gcr.io/cloud-builders/gcloud
- name: gcr.io/cloud-builders/docker
- name: gcr.io/cloud-builders/gke-deploy
由于某种原因,当port1根本不存在时,我在port1上请求一个名称参数时得到了一个错误。
输出:
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版本:www.example.com1.15.9-gke.24
有人知道我错过了什么吗?
3条答案
按热度按时间yks3o0rb1#
重新创建yaml工作:
dsf9zpds2#
看起来像是yaml对齐问题。请确保端口数组在"ports"下缩进
试试看:
r7knjye23#
尝试先写入端口名