In k3s how to whitelist specific namespaces to work with traefik?

In k3s how to whitelist specific namespaces to work with traefik? There is an allowCrossNamespace option for traefik, somewhere, helm or just in its plain setup, and I had to have enabled it because there was the UI for one of my services in a different namespace (longhorn), but I dont like the idea of it being open for all namespaces, also that might get messy with multiple ingresses for the future, so is there a way to whitelist specific namepsaces to work cross-namespace?

I will suggest you to look for k3s network policies. I found the next example code in the net:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: isolate-and-allow-db-system
  namespace: your-target-namespace
spec:
  podSelector: {} # Selects all pods in this namespace
  policyTypes:
    - Egress
  egress:
    # 1. Allow communication with kube-system (for CoreDNS, etc.)
    - to:
        - namespaceSelector:
            matchLabels:
              kubernetes.io/metadata.name: kube-system
    
    # 2. Allow DNS traffic (UDP/TCP Port 53) for kube-system (if CoreDNS runs there)
    - ports:
        - protocol: UDP
          port: 53
        - protocol: TCP
          port: 53

    # 3. Allow traffic to your External Database IP
    - to:
        - ipBlock:
            cidr: 203.0.113.50/32 # REPLACE with your actual external database IP/CIDR

Hope this helps