I'm new to traefik and k3s, I imagined it to be mature so I can install it easily without problems. But I struggle with it. I installed k3s with traefik and from what I've read/googled so far, after adding service+deployment+ingress, it should just work. but it does not
I must be missing something basic, hope you can point me to the problem or link some tutorial/docs I missed.
So after installing k3s with traefik (default), there is this deployment version:
I have a django app, for which service looks like this:
apiVersion: v1 kind: Service metadata: name: web-sandbox-service spec: type: ClusterIP selector: name: web-sandbox ports: - protocol: TCP port: 8000 targetPort: 80 name: HTTP
deployment looks like this:
apiVersion: apps/v1 kind: Deployment metadata: name: web-sandbox labels: app: web-sandbox spec: replicas: 1 strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 0% progressDeadlineSeconds: 120 selector: matchLabels: app: web-sandbox template: metadata: labels: app: web-sandbox spec: containers: - image: registry.gitlab.com/lucas03/digrin-sandbox:commit name: web-sandbox envFrom: - secretRef: name: digrin-sandbox-secret command: ['/bin/sh', 'extras/docker-entrypoint.sh'] ports: - containerPort: 8000 name: gunicorn livenessProbe: httpGet: path: /robots.txt port: 8000 scheme: HTTP initialDelaySeconds: 20 periodSeconds: 10 timeoutSeconds: 3 failureThreshold: 9 readinessProbe: httpGet: path: /robots.txt port: 8000 scheme: HTTP initialDelaySeconds: 20 periodSeconds: 2 failureThreshold: 5 timeoutSeconds: 2 imagePullSecrets: - name: registry-credentials
I believe web-sandbox is running, as I don't see errors and I see logs with robots.txt path being hit by healthcheck.
I thought that I just need to add a ingress object like this and after pointing my subdomain to the IP of the server, it will work:
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: web-sandbox-ingress namespace: default annotations: nginx.ingress.kubernetes.io/limit-rps: "5" nginx.ingress.kubernetes.io/limit-rpm: "100" nginx.ingress.kubernetes.io/ssl-redirect: "false" traefik.ingress.kubernetes.io/router.tls: "false" kubernetes.io/ingress.class: "traefik" spec: ingressClassName: "traefik" rules: - host: sandbox.mydomain.com http: paths: - path: / pathType: Prefix backend: service: name: web-sandbox-service port: number: 80
When I hit the sandbox.mydomain.com it responds with
404 page not found. I wanted to somehow debug this with curl image. But if I wanna hit by pod IP/name e.g.
curl HTTPcurl http://10.43.108.170:8000/robots.txt or
curl http://web-sandbox:8000/robots.txt it just responds:
Couldn't connect to server