404 on K3s with Ingress Route

Hey there,
I am using K3s (v1.29.3+k3s1) on a single VM for a hobby project (no need/desire to upgrade as of now). I did not configure K3s during startup, i.e. I did not disable treafik and I'm using the default configuration K3s provides (k3s).
Accessing the api pod/api service directly using kubectl port-forward verifies the service is working correctly.
Here is my deployment file I applied:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: api
  labels:
    app: api
spec:
  replicas: 1
  selector:
    matchLabels:
      app: api
  template:
    metadata:
      labels:
        app: api
    spec:
      imagePullSecrets:
        - name: SECRET
      containers:
        - name: api
          image: IMAGE
          [...]
---
apiVersion: v1
kind: Service
metadata:
  name: api
spec:
  ports:
    - name: api
      port: 3000
      protocol: TCP
      targetPort: 3000
  selector:
    app: api
  sessionAffinity: None
  type: ClusterIP
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: api-ingress
  namespace: default
spec:
  entryPoints:
    - web
  routes:
    - match: Host(`*`)
      kind: Rule
      services:
        - kind: Service
          name: api
          port: 3000

Trying to access the api via curl GET http://my-api.dev returns a 404 error.
Any ideas what could be the issue?
Thanks in advance :slight_smile:

Update: I resolved the issue. When I was trying to use curl locally, I used the domain http://api.my-domain.dev which did not match Host('*'). Setting the Host it explicitly to Host('api.my-domain.dev') fixed it :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.