k3s Ingress not work in local server but works well on cloud services

34 Views Asked by At

Installed k3s on a local server to implement microservices, one of these is the authentication service that has several end points such as login or logout:

auth-http             NodePort    10.43.221.215   <none>        3001:31621/TCP

If I try to access via postman using ip address and port, the service works well. I created a ingress file like this:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: lastminute
spec:
  rules:
    - http:
        paths:
          - path: /auth/*
            pathType: ImplementationSpecific
            backend:
              service:
                name: auth-http
                port:
                  number: 3001

I need that if I use http:///auth/login or http:///auth/logout it redirects me to the end points login, logout or whatever I need.

I can't understand why the ingress file works in services like AWS or Google Cloud but not on my server.

I would appreciate any help you can give me.

1

There are 1 best solutions below

0
Ron Etch On

I think you should create ingress Class Trafeik based on the documentation.

Probably it work easily on AWS or GCP since ingress classes are auto propagated on platform managed clusters.

Consider also using pathType: Prefix on your deployment.