1
votes

I'm a beginner to Kubernetes, Helm and Yaml. I'm trying to access the QuestDB Console via Kubernetes Ingress Controller setup in my minikube, but i'm getting the below error when running a helm upgrade. Could anyone advice how I can correct this?

Error: UPGRADE FAILED: failed to create resource: Ingress.extensions "questdb" is invalid: spec: Invalid value: []networking.IngressRule(nil): either `defaultBackend` or `rules` must be specified

Here's my overriding value.yaml

ingress:
  enabled: true
  rules:
    - host: localhost
      http:
        paths:
          - path: /questdb
            backend:
              serviceName: questdb-headless
              servicePort: 9000
          - path: /influxdb
            backend:
              serviceName: questdb-headless
              servicePort: 9009     

I've installed the QuestDB helm chart using a local version which has only slightly modified the original ingress.yaml to reference networking.k8s.io/v1 instead of networking.k8s.io/v1beta1. Here's what it is locally:

{{- if .Values.ingress.enabled -}}
{{- $fullName := include "questdb.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else -}}
apiVersion: extensions/v1
{{- end }}
kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
    {{- include "questdb.labels" . | nindent 4 }}
  {{- 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: {{ $svcPort }}
          {{- end }}
    {{- end }}
  {{- end }}

I'm running on these versions:

- helm : v3.6.0
- Kubernetes : 
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.7", GitCommit:"1dd5338295409edcfff11505e7bb246f0d325d15", GitTreeState:"clean", BuildDate:"2021-01-13T13:23:52Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.2", GitCommit:"faecb196815e248d3ecfb03c680a4507229c2a56", GitTreeState:"clean", BuildDate:"2021-01-13T13:20:00Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}

NAME                    NAMESPACE       CHART                           APP VERSION
kubernetes-ingress      default         kubernetes-ingress-1.15.2       1.6.2
questdb                 default         questdb-0.8.0                   6.0.3

More details on the original chart and templates can be found here: https://github.com/questdb/questdb-kubernetes/tree/master/charts/questdb

1

1 Answers

2
votes

The Ingress template expects things to stay under .Values.ingress.hosts but in your values are under .Values.ingress.rules.

Additionally, paths needs to stay directly under hosts items, not under http, because the ingress is using it with a

{{- range .paths }}

under .Values.ingress.hosts items. And, paths are just strings, as the service name and port are directly taken from the fullname and the .Values.service.port


I would try changing your values to something like:

ingress:
  enabled: true
  hosts:
    - host: localhost
      paths:
        - "/questdb"
        - "/influxdb"

or something close to this.

Additionally, you can try and see what is the output of an helm upgrade or install command if you add the parameters --debug --dry-run which could greatly help you identify problems like those, showing the definitions as they will be created (if there's no error while building the template, of course)


Update: since you also changed the Ingress template to use networking.k8s.io/v1, you need to also change how the template is created, because the new kind of Ingress expects things in a different way, as you can see in the documentation: https://kubernetes.io/docs/concepts/services-networking/ingress/

Rules could becomes something like this:

rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
  http:
    paths:
      {{- range .paths }}
      - path: {{ .path }}
        backend:
          service:
            name: {{ .svc }}
            port:
              number: {{ .port }}
      {{- end }}
{{- end }}

and remove the declarations of

{{- $fullName := include "questdb.fullname" . -}}
{{- $svcPort := .Values.service.port -}}

which are now useless. With this, you can change your values in the following:

ingress:
  enabled: true
  hosts:
    - host: localhost
      paths:
        - path: "/questdb"
          svc: questdb-headless
          port: 9000
        - path: "/influxdb"
          svc: questdb-headless
          port: 9009

But the service taht you specify in the values must be created somehwere of course (by the ingress and it needs to expose the desired ports)