https://rancher.com/ logo
n

nutritious-application-85076

07/05/2022, 12:00 PM
Is there a way to troubleshoot a traefix ingress route as I got an error
http 404
? I can access the service using
kubectl port-foward
and address
<http://localhost:7007/catalog>
m

miniature-advantage-69986

07/05/2022, 1:27 PM
So what does your Ingress Manifest look like? Try looking at the traefik logs with "kubectl --namespace kube-system logs -l app=traefik"
n

nutritious-application-85076

07/05/2022, 1:33 PM
Nothing appears within the log of traefix. I will try to make another test later as currently I edited manually an ingress resource which is working using
ingress-nginx
and where I changed the ingressClass and added
<http://traefik.ingress.kubernetes.io/router.entrypoints|traefik.ingress.kubernetes.io/router.entrypoints>: web
m

miniature-advantage-69986

07/05/2022, 2:01 PM
Try the following steps just to verify that the traefik is working correctly:
kubectl create namespace nginx
# create a deployment
kubectl --namespace nginx create deployment nginx --image=nginx
# now create a service
kubectl --namespace nginx expose deployment nginx --port=80 --target-port=80 --name nginx
# now create the ingress
kubectl --namespace nginx create ingress nginx --rule="nginx.localhost/=nginx:80"
Then open your browser (chrome) with the URL http://nginx.localhost or use curl -H "Host: nginx.localhost" http://localhost
n

nutritious-application-85076

07/05/2022, 3:09 PM
That should work as I documented what you proposed here: https://github.com/rancher-sandbox/rancher-desktop/issues/2460 😉
m

miniature-advantage-69986

07/05/2022, 3:29 PM
For Windows/WSL you would have to modify the way you extract the IP Address because there is no node with the name "lima-rancher-desktop" if you use the following snippet it should work on Mac/WSL/Linux:
IP=$(kubectl get node -l <http://node.kubernetes.io/instance-type=k3s|node.kubernetes.io/instance-type=k3s> -o json | jq -r '.items[0].status.addresses[] | select(.type=="InternalIP").address')
n

nutritious-application-85076

07/05/2022, 3:40 PM
Logs of traefix is empty -->
Copy code
kubectl -n kube-system logs traefik-d497b4cb6-hfxgm
time="2022-07-05T15:13:46Z" level=info msg="Configuration loaded from flags."
Here is the ingress resource
Copy code
<http://ingress.networking.k8s.io/my-backstage|ingress.networking.k8s.io/my-backstage> edited
kind: Ingress
metadata:
  annotations:
    <http://traefik.ingress.kubernetes.io/router.entrypoints|traefik.ingress.kubernetes.io/router.entrypoints>: web
  name: my-backstage
  namespace: backstage
spec:
  ingressClassName: traefix
  rules:
  - host: <http://backstage.192.168.205.2.sslip.io|backstage.192.168.205.2.sslip.io>
    http:
      paths:
      - backend:
          service:
            name: my-backstage
            port:
              number: 7007
        path: /
        pathType: Prefix
m

miniature-advantage-69986

07/05/2022, 3:50 PM
you should find some log entries:
kubectl -n kube-system logs -l app=traefik
Copy code
{"level":"info","msg":"Updated status on ingress nginx/nginx","time":"2022-07-05T14:53:25Z"}
{"level":"info","msg":"Server configuration reloaded on :443","time":"2022-07-05T14:53:25Z"}
{"level":"info","msg":"Server configuration reloaded on :9100","time":"2022-07-05T14:53:25Z"}
{"level":"info","msg":"Server configuration reloaded on :80","time":"2022-07-05T14:53:25Z"}
{"level":"info","msg":"Updated status on ingress nginx/whoami","time":"2022-07-05T15:44:48Z"}
{"level":"info","msg":"Server configuration reloaded on :443","time":"2022-07-05T15:44:48Z"}
{"level":"info","msg":"Server configuration reloaded on :9100","time":"2022-07-05T15:44:48Z"}
{"level":"info","msg":"Server configuration reloaded on :80","time":"2022-07-05T15:44:48Z"}
n

nutritious-application-85076

07/05/2022, 3:50 PM
I can access the resource using the nginx example
correct label is
<http://app.kubernetes.io/instance|app.kubernetes.io/instance>: traefik
m

miniature-advantage-69986

07/05/2022, 3:51 PM
OK, then maybe you should discard the "ingressClassName" and the annotations an try again
n

nutritious-application-85076

07/05/2022, 3:51 PM
Yes. Will do that
That works without the annotation. Many thanks for your help
m

miniature-advantage-69986

07/05/2022, 3:54 PM
Perfect, glad i could help you 😃!
n

nutritious-application-85076

07/05/2022, 3:56 PM
This is nevertheless strange that I cannot see logs of the traefix controler
m

miniature-advantage-69986

07/05/2022, 4:02 PM
if i do a
kubectl -n kube-system get pods --show-labels
i get this:
Copy code
NAME                                      READY   STATUS      RESTARTS   AGE   LABELS
...
traefik-799bbc5bd6-8gktn                  1/1     Running     8          35d   app=traefik,chart=traefik-1.81.001,grafzahl=counted,heritage=Helm,pod-template-hash=799bbc5bd6,release=traefik
Maybe you have a typo in the used label, i do not have a label with
<http://app.kubernetes.io/instance=traefik|app.kubernetes.io/instance=traefik>
i'm running Kubernetes v1.20.15+k3s1, that could be the difference
n

nutritious-application-85076

07/05/2022, 4:04 PM
Copy code
traefik-d497b4cb6-hfxgm                   1/1     Running     0             50m     <http://app.kubernetes.io/instance=traefik,app.kubernetes.io/managed-by=Helm,app.kubernetes.io/name=traefik,helm.sh/chart=traefik-10.19.300,pod-template-hash=d497b4cb6|app.kubernetes.io/instance=traefik,app.kubernetes.io/managed-by=Helm,app.kubernetes.io/name=traefik,helm.sh/chart=traefik-10.19.300,pod-template-hash=d497b4cb6>
k8s: 1.22.9, r-d: 1.4.1
I restarted
r-d
and now I can see the logs. Maybe I don have enough memory/cpu on my mac to run the r-d VM
👍 1
249 Views