this post was submitted on 19 Jun 2023
8 points (90.0% liked)

Selfhosted

40402 readers
815 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

Hi all!

I've a background as Linux sysadmin (not much, couple of years) and I'm facing the challenge to setup a Kubernetes cluster.

One of the requirements is to use Traefik.

I'm finding A LOT of how to online but they are all different from each other.

Do you know a good guide to do such things? The K8s cluster is up and running, Traefik is the problem.

I can get it up, access the dashboard, but that's all. I tried to test it using the example application "whoami" and I can see the app in the dashboard but I can access it only by localhost curl on the node where it runs.

Thanks a lot!

top 4 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 1 year ago (1 children)

So, there are a few ways to configure it. But- I'll run down basic steps.

  1. Ensure traefik's service is running as a Loadbalancer, with an exposed IP, OR, expose it as port 443.
  • Use metalLB for provisioning static IPs to services.
  1. To setup services with treafik- either run them as ingress, with traefik as the default ingress controller, or, you can use the ingressroute CRDs. For example- here is an IngressRoute for plex.
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: plex
  namespace: media
spec:
  entryPoints:
    - websecure
  routes:
    - match: Host(`plex.xtremeownage.com`)
      kind: Rule
      services:
        - name: plex
          port: 32400

On your DNS server (Your local network, not K8s), point, plex.yourdomain.com at the IP you provisioned for traefik.

In my network, I pointed *.kube.mydomain.com to the IP of my traefik service/LB.

So, anytime I browser to anything at *.kube.mydomain.com, it automatically sends the request to treaefik. From that point, traefik sends it to the service.

That, should get you started.

[–] myogg 1 points 1 year ago

Definitely a good start. This K3s ansible playbook will provision a cluster for you (with traefik installed).

https://github.com/k3s-io/k3s-ansible

With a few tweaks you can install metallb which will give traefik a static IP, a few DNS entries and you'll be good to go.

[–] [email protected] 1 points 1 year ago

Install traefik via its helm chart (or look at it to see what's required) https://github.com/traefik/traefik-helm-chart

This will make traefik available as ingress controller on your cluster, which will allow you to define ingressroutes to your services

[–] Spazztastik 1 points 1 year ago* (last edited 1 year ago)

I’m on mobile and can’t find any good articles ATM but, start looking up how to expose an app via traefik ingress. You’ll need to create ingress manifests for your applications you want to expose using traefik. Hopefully that gets you started.