Home > OS >  Kubernetes ingres.yml unknown field "service.port.number" in io.k8s.api.networking.v1
Kubernetes ingres.yml unknown field "service.port.number" in io.k8s.api.networking.v1

Time:04-17

I'm running into issues with my ingress.yml. Getting this error:

error: error validating "ingress.yml": error validating data: [ValidationError(Ingress.spec.rules[0].http.paths[0].backend): unknown field "service.name" in io.k8s.api.networking.v1.IngressBackend, ValidationError(Ingress.spec.rules[0].http.paths[0].backend): unknown field "service.port.number" in io.k8s.api.networking.v1.IngressBackend, ValidationError(Ingress.spec.rules[0].http.paths[1].backend): unknown field "service.name" in io.k8s.api.networking.v1.IngressBackend, ValidationError(Ingress.spec.rules[0].http.paths[1].backend): unknown field "service.port.number" in io.k8s.api.networking.v1.IngressBackend];

Based on this documentation serviceName changed to service.name and servicePort changed to service.port and so on. Here is the ingress file:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: bitwarden
  namespace: bitwarden
  labels:
    app: bitwarden
  annotations:
    # the name of the nginx-ingress-controller class
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/configuration-snippet: |
      more_set_headers "Request-Id: $req_id";
    nginx.ingress.kubernetes.io/connection-proxy-header: "keep-alive"
    nginx.ingress.kubernetes.io/enable-cors: "true"
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/limit-connections: "25"
    nginx.ingress.kubernetes.io/limit-rps: "15"
    nginx.ingress.kubernetes.io/proxy-body-size: 1024m
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "10"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "1800"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
spec:
  tls:
  - hosts:
    - kryskanbit.ddns.net
    secretName: bitwarden-tls
  rules:
  - host: kryskanbit.ddns.net
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service.name: bitwarden
          service.port.number: 80
      - path: /notifications/hub
        pathType: Exact
        backend:
          service.name: bitwarden
          service.port.number: 3012

CodePudding user response:

Kubernetes has a special treatment for YAML format, so basically, you just need to extend the properties individually the service.name and service.port.number:

...
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: bitwarden
                port:
                  number: 80
          - path: /notifications/hub
            pathType: Exact
            backend:
              service:
                name: bitwarden
                port:
                  number: 3012
  • Related