服务"php"无效:spec.ports:必需值 [英] The Service "php" is invalid: spec.ports: Required value

查看:69
本文介绍了服务"php"无效:spec.ports:必需值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照本教程 https://www.cloudbooklet.com/kubernetes-basic-php-application-with-nginx-on-google-cloud/,当我到达此命令时, kubectl apply -f php_service.yaml-validate = false 会弹出此错误:

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:

服务"php"无效:spec.ports:必需的值.

The Service "php" is invalid: spec.ports: Required value.

我该如何解决?这是yaml文件:

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

推荐答案

您的语法错误.协议和端口应为 spec.ports 字段中的项目.它看起来应该类似于

Your syntax is wrong. Protocol and port should be items from the spec.ports field. It should look something like this

这篇关于服务"php"无效:spec.ports:必需值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆