Home > Software design >  Ingress route for all paths in a host
Ingress route for all paths in a host

Time:12-28

I have a local test environment with k3s.
I am trying to reach a local jenkins pod running in one of the k3s workers via ingress.
I have configured the ingress object to answer on a specific host for all paths, but it doesnt seem to work.
Im always getting 404 in the traefik logs.
Is there a way to check how the request is flowing?
The configs:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: jenkins
  namespace: jenkins
  labels:
    app: jenkins
spec:
  rules:
    - host: jenkins.homelab.internal
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: jenkins
                port: 
                  number: 80

CodePudding user response:

Maybe your IngressClass isn'n set to default so your ingress is not allocated to it.

Try to set it specific in the ingress.

spec:
  ingressClassName: nginx
  rules:
    ...

CodePudding user response:

When the ingressclass.kubernetes.io/is-default-class annotation is set to true on an IngressClass resource, new Ingresses will be assigned this default IngressClass even if no ingressClassName field is specified.

annotations:
   ingressclass.kubernetes.io/is-default-class: "true"

Multiple Ingress objects on one Ingress use the below annotations:

annotations: 
    kubernetes.io/ingress.class: nginx

Make sure metadata.name is one-of-a-kind. If metadata.name is the same for each object, the new configuration simply replaces it.

Follow the Ingress path matching for your issue, here is a blog explaining the path matching

  • Related