https://rancher.com/ logo
Title
c

chilly-telephone-51989

08/21/2022, 6:10 PM
I'm running k3s locally and i need to have ingress from which the traffic should divert to "gateway" service this is my very simple ingress file. I'm unable to access it even with my local machine ip. is there something wrong with the file?
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: Ingress
metadata:
  name: ingress
  namespace: xplore
  annotations:
    <http://kubernetes.io/ingress.class|kubernetes.io/ingress.class>: traefik
spec:
  rules:
    - http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: gateway
                port:
                  number: 80
1
k

kind-nightfall-56861

08/22/2022, 8:29 AM
A small example of my Ingress configuration. It does use Let's Encrypt to create the HTTPS endpoints, so you might have to either adapt the configuration or implement it the same way:
---
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: Ingress
metadata:
  name: cloudflare-webapp
  annotations:
    <http://kubernetes.io/ingress.class|kubernetes.io/ingress.class>: "traefik"
    <http://cert-manager.io/cluster-issuer|cert-manager.io/cluster-issuer>: letsencrypt-prod
spec:
  rules:
  - host: <http://cloudflare.krakensoftware.eu|cloudflare.krakensoftware.eu>
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: cloudflare-webapp-np
            port:
              number: 80
  tls:
  - hosts:
    - <http://cloudflare.krakensoftware.eu|cloudflare.krakensoftware.eu>
    secretName: cloudflare-krakensoftware-eu-tls
I see small differences, but I feel like there is something with your nodeport that results in it not working.
c

chilly-telephone-51989

08/22/2022, 8:56 AM
is providing a host necessary? I'm running it on local machine so can't have host name it's only localhost
how would I test the things using k3s on my local machine? ingress does run on my IP, it's just that it's not forwarding anything to gateway and it says 502 Bad gateway. not sure where the problem is in ingress file
k

kind-nightfall-56861

08/22/2022, 9:02 AM
Just to doublecheck, you have verified all kube-system pods are running and in the correct state?
+
c

chilly-telephone-51989

08/22/2022, 10:02 AM
not only they are running in the correct state, I can call the rest api of these pods from each other, I entered one pod used wget to issue commands to the other pods. all fine,
is there any command you want me to execute to figure out the problem?
k

kind-nightfall-56861

08/22/2022, 10:35 AM
That's all I can tell for now
👀 1
c

chilly-telephone-51989

08/22/2022, 12:51 PM
I figured it out, it was not ingress it was the gateway krakend that was causing the issues. ingress was working correctly the gateway had a particular issue that caused it to discard all the requests silently. The article you shared is really very helpful. thank you for all the guidance.
k

kind-nightfall-56861

08/22/2022, 1:10 PM
Np 😄 Glad you figured it out