本文介绍了Kubernetes api版本:'Ingress'的networking.k8s.io/v1问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在执行Kubernetes YAML文件时希望获得有关问题的指导.我的kubectl版本如下:

Wanted your guidance on an issue while executing a Kubernetes YAML file.My kubectl version is as follows:

    Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.0", GitCommit:"af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38", GitTreeState:"clean", BuildDate:"2020-12-08T17:59:43Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"windows/amd64"}
    Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.14", GitCommit:"89182bdd065fbcaffefec691908a739d161efc03", GitTreeState:"clean", BuildDate:"2020-12-18T12:02:35Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}

这是从Kubernetes站点下载的最新版本. https://kubernetes.io/docs/tasks/工具/install-kubectl/#install-kubectl-on-windows

This is the latest version downloaded from the Kubernetes sitehttps://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-windows

YAML具有apiVersion:networking.k8s.io/v1种类:入口而运行YAML的错误是

The YAML hasapiVersion: networking.k8s.io/v1kind: Ingressand the error on running the YAML is

    no matches for kind "Ingress" in version "networking.k8s.io/v1"

Kubernetes问题 https://github.com/kubernetes/kubernetes/issues/90077提到

Kubernetes issue https://github.com/kubernetes/kubernetes/issues/90077 mentions that

  networking.k8s.io/v1beta1 == 1.14 to 1.18
  networking.k8s.io/v1 = 1.19+

所以我猜它应该工作正常吗?

So I guess it should be working right?

我已将API版本更改为

I have changed the API Version to

apiVersion: extensions/v1beta1 or
apiVersion: networking.k8s.io/v1beta1

但在YAML的另一部分中失败

but fail in another section of the YAML

backend:
  service:
    name: {{ template "fullname" $ }}-srv
     port:
       number: 80

有错误

错误验证数据:ValidationError(Ingress.spec.rules [0] .http.paths [0] .backend):未知字段服务";在io.k8s.api.extensions.v1beta1.IngressBackend

error validating data: ValidationError(Ingress.spec.rules[0].http.paths[0].backend): unknown field "service" in io.k8s.api.extensions.v1beta1.IngressBackend

我被告知相同的YAML可以在具有相同kubectl版本的macOS上运行(尽管我无权对此进行验证).但是对我可能会出错的地方有任何想法吗?

I am informed that the same YAML works on macOS with the same kubectl version (I do not have access to verify that though). But any thoughts on where I could be going wrong?

谢谢,巴巴拉语

推荐答案

对于 networking.k8s.io/v1beta1 应该是

backend:
  serviceName: {{ template "fullname" $ }}-srv
  servicePort: 80

如何获取文档:

kubectl explain --api-version=networking.k8s.io/v1beta1 ingress.spec.rules.http.paths.backend

这篇关于Kubernetes api版本:'Ingress'的networking.k8s.io/v1问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 22:05