'K3S: Can't access my web. is there any problem in my yaml files?

I deploy my web service on K3S. I use DuckDNS to access https. i can access my domain with https. But i can't access my web service specific URL. Here is my yaml files

Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: auto-trade-api
spec:
  replicas: 1
  selector:
    matchLabels:
      app: auto-trade-api
  template:
    metadata:
      labels:
        app: auto-trade-api
    spec:
      containers:
        - name: auto-trade-api
          image: image
          args: ['yarn', 'start']
          resources:
            requests:
              cpu: '200m'
              memory: '200Mi'
            limits:
              cpu: '200m'
              memory: '200Mi'
          envFrom:
            - secretRef:
                name: auto-trade-api
          ports:
            - containerPort: 3001
      restartPolicy: Always
      imagePullSecrets:
        - name: regcred

Service

kind: Service
metadata:
  name: auto-trade-api
spec:
  type: "NodePort"
  selector:
    app: auto-trade-api
  ports:
    - protocol: TCP
      port: 3001
      targetPort: 3001

Ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: auto-trade-api
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    kubernetes.io/ingress.class: "traefik"
    cert-manager.io/cluster-issuer: "letsencrypt"
spec:
  tls:
    - hosts:
      - mydomain
      secretName: auto-trade-api-tls
  rules:
    - host: mydomain
      http:
        paths:
        - path: /*
          pathType: Prefix
          backend:
            service:
              name: auto-trade-api
              port:
                number: 3001

i tried access https://mydomain/users that i made. but only display 404 page not found I think i did connect each component well.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source