kuberneteskubernetes-helmkubernetes-ingress

Ingress helm chart error after upgrade from v1beta1 to v1


I'm following an online Tutorial to learn how to use helm: https://wkrzywiec.medium.com/how-to-deploy-application-on-kubernetes-with-helm-39f545ad33b8

I can follow without error until almost to the end; the following command:

helm install -f ingress.yaml ingress ./ingress

I then found after some googleing, that i need to upgrade from networking.k8s.io/v1beta1 to networking.k8s.io/v1. However some of the structure changed. The main thing I changed is adding a http: below host and pushing the paths a level down, as is done in newer ingress examples. This got rid of most error, but one is this there and I don't understand it. I think i probably messed something up or miss a different necessary change. So if anyone could tell me, what my mistake is, that would be amazing.

Details: The file structure looks like this:

Ingress.yaml original (tutorial):

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: {{ .Values.ingress.name }}
  annotations:
    kubernetes.io/ingress.class: {{ .Values.ingress.annotations.class }}
spec:
  rules:
  {{- range .Values.ingress.hosts }}
    - host: {{ .host | quote }}
      http:
        paths:
        {{- range .paths }}
          - path: {{ .path }}
            backend:
              serviceName: {{ .backend.serviceName }}
              servicePort: {{ .backend.servicePort }}
        {{- end }}
  {{- end }}

Ingress.yaml after my fixing attempts:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ .Values.ingress.name }}
  annotations:
    kubernetes.io/ingress.class: {{ .Values.ingress.annotations.class }}
spec:
  rules:
  {{- range .Values.ingress.hosts }}
    - host: {{ .host | quote }}
      http:
        paths:
        {{- range .paths }}
          - path: {{ .path }}
            pathType:  {{ .pathType }}
            backend:
              serviceName: {{ .backend.serviceName }}
              servicePort: {{ .backend.servicePort }}
        {{- end }}
  {{- end }}

values.yaml original:

ingress:
  name: ingress-service
  replicaCount: 1
  annotations: 
    class: nginx
  hosts:
    - host: chart-example.local
      paths: 
        - path: /
          backend:
            serviceName: serviceName
            servicePort: 8080

values.yaml after my fixing attemps:

ingress:
  name: ingress-service
  replicaCount: 1
  annotations: 
    class: nginx
  hosts:
    - host: chart-example.local
      http:
        paths: 
          - path: /
            pathType: ImplementationSpecific
            backend:
              serviceName: serviceName
              servicePort: 8080

ingress.yaml (the one on the outside, original tutorial):

ingress:
  hosts:
    - host: adminer.k8s.com
      paths:
        - path: /
          backend:  
            serviceName: adminer
            servicePort: 8080
    - host: kanban.k8s.com
      paths: 
        - path: /api/
          backend:
            serviceName: kanban-app
            servicePort: 8080
        - path: /
          backend:
            serviceName: kanban-ui
            servicePort: 80

and the same ingress.yaml after my fixing attempts:

ingress:
  hosts:
    - host: adminer.k8s.com
      http:
        paths:
          - path: /
            backend:  
              serviceName: adminer
              servicePort: 8080
    - host: kanban.k8s.com
      http:
        paths: 
          - path: /api/
            backend:
              serviceName: kanban-app
              servicePort: 8080
          - path: /
            backend:
              serviceName: kanban-ui
              servicePort: 80

The original Errors:

Before upgrade from v1beta1

~/Downloads/webboard$ helm install -f ingress.yaml ingress ./ingress

Error: INSTALLATION FAILED: unable to build kubernetes objects from release manifest: resource mapping not found for name: "ingress-service" namespace: "" from "": no matches for kind "Ingress" in version "networking.k8s.io/v1beta1"
ensure CRDs are installed first

After upgrade to v1

~/Downloads/webboard$ helm install -f ingress.yaml ingress ./ingress

W0614 14:38:25.746260 1133539 warnings.go:70] unknown field "spec.rules[0].http.paths[0].backend.serviceName"
W0614 14:38:25.746280 1133539 warnings.go:70] unknown field "spec.rules[0].http.paths[0].backend.servicePort"
W0614 14:38:25.746287 1133539 warnings.go:70] unknown field "spec.rules[1].http.paths[0].backend.serviceName"
W0614 14:38:25.746294 1133539 warnings.go:70] unknown field "spec.rules[1].http.paths[0].backend.servicePort"
W0614 14:38:25.746300 1133539 warnings.go:70] unknown field "spec.rules[1].http.paths[1].backend.serviceName"
W0614 14:38:25.746306 1133539 warnings.go:70] unknown field "spec.rules[1].http.paths[1].backend.servicePort"
Error: INSTALLATION FAILED: 1 error occurred:
    * Ingress.networking.k8s.io "ingress-service" is invalid: [spec.rules[0].http.paths[0].pathType: Required value: pathType must be specified, spec.rules[1].http.paths[0].pathType: Required value: pathType must be specified, spec.rules[1].http.paths[1].pathType: Required value: pathType must be specified]

After all of my fixing (adding the http below host):

~/Downloads/webboard$ helm install -f ingress.yaml ingress ./ingress

Error: INSTALLATION FAILED: 1 error occurred:
    * Ingress.networking.k8s.io "ingress-service" is invalid: [spec.rules[0].http.paths: Required value, spec.rules[1].http.paths: Required value]

If i can help with any other info, please just say the word.


Solution

  • Shayki was partially correct, some other parts where also missing. I found the Deprecation guide which details the changes: Deprecation Guide. Following all those changes solved my issues.