Kubernetes Ingress掌舵定义的问题

时间:2018-10-19 10:18:25

标签: docker kubernetes kubernetes-helm

我正在尝试使用头盔部署以下Ingress:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    io.ctl.cd/ssl: "ui.releasename"
  name: ui
  labels:
    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
spec:
  rules:
    {{ if eq .Values.nodeSelector.location "minikube" }}
    - host: ui.{{ .Release.Namespace  }}.minikube.test
    {{ else }}
    - host: ui.{{ .Release.Namespace  }}.devhost
    {{ end }}
      http:
        paths:
        - backend:
            serviceName: api
            servicePort: {{ .Values.api.service.port }}
          path: /

我收到以下错误     错误:release x-**** failed: Ingress in version "v1beta1" cannot be handled as a Ingress: only encoded map or array can be decoded into a struct

我有一个非常相似的入口,可以很好地工作,我不希望这个事件发生。

1 个答案:

答案 0 :(得分:1)

我认为此字符串有问题:

chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"

要进行测试,请尝试:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    io.ctl.cd/ssl: "ui.releasename"
  name: ui
  labels:
    chart: "{{ .Chart.Name }}"
spec:
  rules:
    {{ if eq .Values.nodeSelector.location "minikube" }}
    - host: ui.{{ .Release.Namespace  }}.minikube.test
    {{ else }}
    - host: ui.{{ .Release.Namespace  }}.devhost
    {{ end }}
      http:
        paths:
        - backend:
            serviceName: api
            servicePort: {{ .Values.api.service.port }}
          path: /