错误: 升级失败: 验证" "时出错 : 验证数据时出错: 验证错误(Ingress.spec.rules[0].http): 缺少必填字段"paths"



我对使用舵图非常陌生,不知道为什么在安装舵图时会出现这个错误。我使用--set with helm install命令来设置ingress.hosts[0].host处的主机名;路径";已存在。

ingress.yaml

{{- if .Values.ingress.enabled -}}
{{- $fullName := include "project.fullname" . -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app.kubernetes.io/name: {{ include "project.name" . }}
helm.sh/chart: {{ include "project.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}
{{- end }}

values.yaml

...
...
...
ingress:
enabled: true
hostname: some_hostname
annotations:
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: "true"
nginx.ingress.kubernetes.io/proxy-connect-timeout: "180"
nginx.ingress.kubernetes.io/proxy-send-timeout: "180"
nginx.ingress.kubernetes.io/proxy-read-timeout: "180"
hosts:
- host: some_hostname
paths: [/]
tls:
- secretName: some_secretname
hosts: 
- some_hostname
resources: {}
...
...
...

安装舵的命令

helm upgrade --install $(PROJECT_NAME) --set ingress.hosts[0].host="${HOST_NAME} --set ingress.tls[0].hosts="{${HOST_NAME}}"" 

错误:

Error: UPGRADE FAILED: error validating "": error validating data: ValidationError(Ingress.spec.rules[0].http): missing required field "paths" in io.k8s.api.extensions.v1beta1.HTTPIngressRuleValue

我也遇到了同样的问题,出于某种原因,如果在--set中定义主机,则还必须在集合中定义路径(即使它与yaml匹配(。像这样,

helm upgrade --install $(PROJECT_NAME) --set ingress.hosts[0].host=${HOST_NAME}  --set ingress.hosts[0].paths[0]=/

我还没有做tls,所以我不确定是否也有同样的问题。

相关内容

  • 没有找到相关文章

最新更新