Traefik Crash Course (Without docker)

  Рет қаралды 48,653

Hussein Nasser

4 жыл бұрын

Traefik is an open-source reverse proxy written in GO and marketed as an Edge Router. It supports automatic TLS and HTTP/2 by default and other cloud native features. In this video I want to discuss Traefik as a reverse proxy and load balancer.
0:00 Intro
2:00 Problem
4:00 Traefik Architecture
11:00 TCP vs HTTP Proxying
12:00 Demo
15:30 Install Treafik Docker
16:40 Treafik as a Layer 7 Proxy
18:00 Static Configuration
20:00 Proxy to all 4 backend NodeJS services
27:00 Split load to multiple backends (app1/app2)
32:00 Block certain requests (/admin)
34:20 Weighted RR
38:30 Treafik as a Layer 4 Proxy (tcp router)
43:30 Create DNS record
44:40 Enable HTTPS on Treafik (lets encrypt)
50:00 Disable 1.1/1.0 Enable TLS 1.2 and TLS 1.3
53:50 Summary
Resources
docs.traefik.io/providers/file/
Config
github.com/hnasr/javascript_playground/tree/master/traefik
🏭 Backend Engineering Videos
kzfaq.info/sun/PLQnljOFTspQUNnO4p00ua_C5mKTfldiYT
💾 Database Engineering Videos
kzfaq.info/sun/PLQnljOFTspQXjD0HOzN7P2tgzu7scWpl2
🛰 Network Engineering Videos
kzfaq.info/sun/PLQnljOFTspQUBSgBXilKhRMJ1ACqr7pTr
🏰 Load Balancing and Proxies Videos
kzfaq.info/sun/PLQnljOFTspQVMeBmWI2AhxULWEeo7AaMC
🐘 Postgres Videos
kzfaq.info/sun/PLQnljOFTspQWGrOqslniFlRcwxyY94cjj
🚢Docker
kzfaq.info/sun/PLQnljOFTspQWsD-rakNw1C20c1JI8UR1r
🧮 Programming Pattern Videos
kzfaq.info/sun/PLQnljOFTspQV1emqxKbcP5esAf4zpqWpe
🛡 Web Security Videos
kzfaq.info/sun/PLQnljOFTspQU3YDMRSMvzflh_qXoz9zfv
🦠 HTTP Videos
kzfaq.info/sun/PLQnljOFTspQU6zO0drAYHFtkkyfNJw1IO
🐍 Python Videos
kzfaq.info/sun/PLQnljOFTspQU_M83ARz8mDdr4LThzkBKX
🔆 Javascript Videos
kzfaq.info/sun/PLQnljOFTspQWab0g3W6ZaDM6_Buh20EWM
👾Discord Server discord.gg/CsFbFce
Become a Member
kzfaq.info/love/_ML5xP23TOWKUcc-oAE_Egjoin
Support me on PayPal
bit.ly/33ENps4
Become a Patreon
www.patreon.com/join/hnasr?
Stay Awesome,
Hussein

Пікірлер: 90
@mujun_kross
@mujun_kross 2 жыл бұрын
I have been trying to get my head around how to setup and use Traefik. This tutorial has helped me more than any other I have tried to follow. Thank you for the excellent tutorial and I look forward to viewing more of your work. Keep up the good job!
@EddyCaffrey
@EddyCaffrey 4 жыл бұрын
Finally the long-awaited Traefik video. Thanks, Mr. Hussein. Great like always. Thank you also for taking the time to learn and share your knowledge with us.
@hnasr
@hnasr 4 жыл бұрын
Thanks Eddy!
@kapurar
@kapurar Жыл бұрын
Thank you! One of the best tutorials I have see on Traefik. I particularly apprecaite the fact that you did it without Docker and didnt just cut and paste some YAMl file.
@henrygraterol
@henrygraterol 2 жыл бұрын
Great tutorial! I also think traefik is overly complicated, but you have managed somehow to explain it in a manner I could understand the whole concept. Also, good choice of explaining this using a file as the provider. It made things easier to understand. Thank you!
@jairunet
@jairunet 2 жыл бұрын
There are a lot of people posting complicated, copy paste, with strange assumptions, you do it the right way Hussein. The fundamentals are core important, as you say the most important detail "understand"! thank you so very much I enjoy every note you shared, excellent, and I am definitely looking forward to continue learning from your excellent explanation.
@mutley11
@mutley11 3 жыл бұрын
Thanks for your huge effort on this; the pain you go through was most instructive. I was writing a much bigger comment, but KZfaq lost it when it moved onto the next video 😒, so I'll just say that: - Traefik is less like a traditional load-balencer or a reverse-proxy, but is instead designed as an ingress-controller; this is particularly evident in the documention around middlewares - Traefik is easier to type if you pronounce it "tray-fik" - and if you really don't like YAML, Traefik also support TOML I love your videos; they make it much easier to try and stay up-to-date (I had no idea there even was such as a thing as HTTP/3 until I found your channel). Thanks!
@tdevzone2654
@tdevzone2654 4 жыл бұрын
i like your enthusiasm when making this type of video thank you a loooooooot
@jeansilga3516
@jeansilga3516 6 ай бұрын
Great video! I was able to get up and running pretty quickly with traefik thanks to this video. You made a wonderful job right there. I love your mindset. Keep up the good work. Cheers!
@roger74989
@roger74989 3 жыл бұрын
Great course!. I was able to understand a lot of things that I didn't know how it worked.
@chrisumali9841
@chrisumali9841 2 жыл бұрын
thanks for the demo and info. I have setup traefik 2.6 with a cloudflare ARGO. The journey took several hours, but I guess its done. I learned some insight into your demo. Thanks, and have a great day
@shahinbayat
@shahinbayat 4 жыл бұрын
That's great, u finally created a crash course on this awesome tool. Thanks alot
@NastyWicked
@NastyWicked 4 жыл бұрын
Great guide as always, nothing is boring with your enthusiasm :) Also, when it comes to copy pasting tab-formatted text into tab aware IDEs, you can usually select the text and Shift + Tab to remove the indentations, should also work in Visual Studio Code
@hnasr
@hnasr 4 жыл бұрын
Mind blown 🤯 nice tip thank you 🙏😍
@ddpxl
@ddpxl 3 жыл бұрын
@@hnasr you actually do it at 29:22 ;)
@JensenSiu
@JensenSiu 2 жыл бұрын
This tutorial is the only one I have found explaining Traefik without the use of docker and docker-compose.yml which is widely used almost anywhere else. So many thanks Hussein ! As yourself, I am working on my homelab environnement under macOS and there are so many restrictions compared to Linux systems that I am still struggling with very basics configurations. For example, at start, I tried to use Traefik with Docker Desktop. Then I realized that on non-Linux systems, it is impossible to share the same network as the local machine for docker services. Therefore, it is impossible to get real client IPs. Then, I toggled to the standalone version of Traefik (easy homebrew on macOS!) wich makes it possible. But I encountered a new problem with Let's Encrypt certificates behind Cloudflare which needs to pass environnement API key to authenticate certificate generation. At this point, I found no informations either on Traefik documentation or on forums to declare those API keys trough static or dynamic configuration files (the other only uses docker-compose.yml to declare those keys). For the time being, I use previously manually generated certificates from Let' Encrypt stored on my local machine but I fell very frustrated to miss the use of the automatic service provided by Traefik. Would you have a solution for this problem ?
@AkshayKarode
@AkshayKarode Жыл бұрын
Much relief bro, you simply did very good. The video that traefik docs team should really watch.
@pestorosso450
@pestorosso450 3 жыл бұрын
Thank you soooo much! I was a little bit frustrated with the traefik docs.
@KennedyWaithaka
@KennedyWaithaka Жыл бұрын
Great explanation. Traefik is overwhelming but once you get over the basics, everything flows naturally. I think explicit is better, so i appreciate Rule being mandatory field
@m_codes
@m_codes Ай бұрын
Love your content bro. Very appreciated
@cappedvillain2522
@cappedvillain2522 3 жыл бұрын
Haha epic. Possibly my best channel to watch. Thank you
@AK474000
@AK474000 Жыл бұрын
This is Godsend too many tuts for Traefik is just copy this paste that and I get that this has the potential of automating stuff with certain services, but I never felt it was explained well and the labels thing that gets injected into Docker Compose files only adds to the confusion for me. Thanks for the stripped back approach to how to use this project.
@Giondo
@Giondo 3 жыл бұрын
great video!, I was expecting something more related to k8s (architecture) and how it works how connections are made traffic flow and those kind of stuff, but is good for basic understanding of traefik anyway :), Thanks!
@ramane2900
@ramane2900 2 жыл бұрын
Loved every second of the video..
@rasheed.a873
@rasheed.a873 2 жыл бұрын
Good videos as always brother
@danydanger
@danydanger 2 жыл бұрын
Wow!! kudos to u Hussein, after so long able to learn about Traefik in such a simple way, Keep up the good work !!! Also, can you also share how and where to learn YAML from ?
@usmonbekravshanov6933
@usmonbekravshanov6933 9 ай бұрын
This channel is a true gem
@ghassenbenmansour3159
@ghassenbenmansour3159 3 жыл бұрын
Great video, thanks for sharing :)
@hnasr
@hnasr 3 жыл бұрын
Thanks Ghassen
@exelfer081
@exelfer081 Жыл бұрын
Thank you... I start learn traefik
@lun1c0n
@lun1c0n 3 жыл бұрын
Hussein, first thing to do when playing with new software is enable maximum logging (in traefik --log.level=DEBUG) ;)
@johnclarkson6120
@johnclarkson6120 3 жыл бұрын
you know what... you are amazing instructor... thx a lot.. it's so useful...
@hnasr
@hnasr 3 жыл бұрын
Glad it was helpful! thanks!
@johnclarkson6120
@johnclarkson6120 3 жыл бұрын
@@hnasr what if add docker-compose version configuration...wow..amazing dude...cool man...thx a lot.
@ivanmaglica264
@ivanmaglica264 Жыл бұрын
Great tutorial! Yaml processing is not done by traefik itself, but yaml processing library, so error logging is done by it. These problems (duplicate keys) are usually caught by vscode these days.
@George.Targaryen
@George.Targaryen 11 ай бұрын
These guy is Amazing!
@xenossephiroth8225
@xenossephiroth8225 4 жыл бұрын
We use traefik with docker. The docker label make it so easy to upgrade, no nginx dns problem any more.
@EduardoMazolini
@EduardoMazolini 5 ай бұрын
Vi diversos vídeos sobre traefik esse foi o mais didático.
@santoshakhilesh
@santoshakhilesh 4 жыл бұрын
Nice one.
@speakthememe
@speakthememe Жыл бұрын
thank you, i lov you
@dojohansen123
@dojohansen123 3 жыл бұрын
Thanks. Nice for once to see someone presenting something while still retaining some critical sense. This is, IMHO, definitely not production ready. (And I *really* hate this megatrend, in general, away from strict behavior towards "best effort" and guesses and all the rest of the script-kiddie approach..!)
@thannasip8001
@thannasip8001 4 жыл бұрын
Thanks 😊
@hnasr
@hnasr 4 жыл бұрын
30:40 yell at me guys
@Operaatoors
@Operaatoors 3 жыл бұрын
Exactly... :D The question is, how did you manage to learn all this stuff before this video? I am struggling hard time...
@nyamdorjtsereg9543
@nyamdorjtsereg9543 3 жыл бұрын
"how it's production ready" i'm dead xD
@thatguy6225
@thatguy6225 3 жыл бұрын
A crash course when you jump into traefik! Nice puns.
@abhaykatiyar3539
@abhaykatiyar3539 Жыл бұрын
Hi Hussein , i have a question regarding noip setup. Do we need to setup ddns in our router for the hostname from noip
@Lavaboy1985
@Lavaboy1985 3 жыл бұрын
I'm a little too late to this show, but you can block access with a ton of middlewares traefik is capable of. You need to tell your service to make use of it. For example "Errors" or IpWhitelist. Middlewares are capable of redirect http to https aswell.
@MehdiShojaei
@MehdiShojaei 4 жыл бұрын
Hi Hossein, Thanks so much for your useful researches. Just as a suggestion, How do you think about adding some very simple benchmarks to some of your demos? For example, comparing your demos using these different Edge proxies for Request Per Second, Latency, and Error Ratio, using tools like *wrk*? I know benchmarks are not an absolute thing, but they can give viewers some hints in terms of performance.
@hnasr
@hnasr 4 жыл бұрын
Nice idea! Thanks Mahdi
@moshiurmd.rahmanshuvo3067
@moshiurmd.rahmanshuvo3067 Жыл бұрын
Is there any package for installing traefik on ubuntu? Or do I need to build traefik from source to use it on ubuntu?
@jatinofficial
@jatinofficial 4 жыл бұрын
Any chance for traefik in docker?
@user-hi7pc4bg7v
@user-hi7pc4bg7v 6 ай бұрын
Can you give me a way how to block a certain path, cuz i tried to follow you (32:00) but this way is deprecated
@nurhusni
@nurhusni 2 жыл бұрын
2 years later, do you now understand traefik with docker and will you make a crash course & tutorial about that?
@colinm3130
@colinm3130 3 жыл бұрын
I am curious about how all the letsencrypt stuff is automatic. It was to be renewed every 3 months. Is that automatic too? I assume you have to have letsencrypt already installed and run the update script?
@colinm3130
@colinm3130 3 жыл бұрын
Oh acme, now I get it.
@pipi_delina
@pipi_delina 4 жыл бұрын
when will you do a tut on docker... I like it when you teach
@hnasr
@hnasr 4 жыл бұрын
Ismail Yushaw I might do a full tutorial on it. i have a playlist using docker Docker kzfaq.info/sun/PLQnljOFTspQWsD-rakNw1C20c1JI8UR1r
@jjames7206
@jjames7206 4 жыл бұрын
Thanks Hussein , I start knowing a lot of LB softwares not just nginx , all these knowledges because you! Thank you! By the way does Traefik and Caddy support automatic renew SSL?
@hnasr
@hnasr 4 жыл бұрын
J James thank you very happy I could help 🙏 and yes both Caddy and Traefik support that
@aishasyed5704
@aishasyed5704 3 жыл бұрын
traefik on kubernetes as ingress controller video please :)
@bashardlaleh2110
@bashardlaleh2110 Жыл бұрын
I think some configuration and abstractions in Traefik don't make sense in a normal environment because Traefik was designed for containerized environments (swarm, k8s, ecs,....etc) where backends are always-changing containers and that's why you struggled to make it work with TCP because it's not meant to be used like that
@mmalam7182
@mmalam7182 4 жыл бұрын
do u have patreon? please take my money
@mohammedhewedy8231
@mohammedhewedy8231 3 жыл бұрын
Can you please work on making the sound louder in the next episodes?
@dbassett74
@dbassett74 3 жыл бұрын
Is it just me or does all the gripes in this video actually point to advantages? I think Traefik is amazing.
@hnasr
@hnasr 3 жыл бұрын
Dan I have no doubt, A lot of people like traefik (see comments) so it actually might be just me 😅
@ddpxl
@ddpxl 3 жыл бұрын
besides autorenewing letsencrypt, traefik shines most in k8s environments which can me highly dynamic. i don't even want to start thinking about configuring nginx with 20+ services that go up and down and change ip and port constantly. you would need to have some script talking to the k8s api and grab the nodes and whatnot... traefik does that magic with a few lines of yaml.. and just like k8s lets you forget about the plumbing behind the scenes.
@pipi_delina
@pipi_delina 4 жыл бұрын
does it support something like DNS
@the.turd.sandwich
@the.turd.sandwich 4 жыл бұрын
What do you mean by that?
@pipi_delina
@pipi_delina 4 жыл бұрын
Assumin I have 4 Authoritative DNS servers... Thats what I mean... use Traefik to load balance them
@baltox61
@baltox61 2 жыл бұрын
i did as he suggested and just jumped into traffic, did not end well
@user-ye8zh3ep7m
@user-ye8zh3ep7m 4 жыл бұрын
Envoy proxy?
@hnasr
@hnasr 4 жыл бұрын
Роман Воловик yes that’s probably next
@vim55k
@vim55k 4 жыл бұрын
Linkerd maybe?
@user-ye8zh3ep7m
@user-ye8zh3ep7m 4 жыл бұрын
@@vim55k no, envoy exactly
@corneliuslumos668
@corneliuslumos668 3 жыл бұрын
12:33 I have the same problem as you, it's a curse actually :-(
@antontishchenko294
@antontishchenko294 3 жыл бұрын
49:22 The same name for routers. That is why HTTPS is resolved and HTTP is not resolved.
@antontishchenko294
@antontishchenko294 3 жыл бұрын
52:40 You have asked why HTTP doesn't work and found the answer. Ignore my comment, it doesn't make sense when I watched full video :-)
@corneliuslumos668
@corneliuslumos668 3 жыл бұрын
8:30 Fuck I am toast if I don't figure this out
@BryanChance
@BryanChance Жыл бұрын
i'm already not using Traffic...err Traefic....Traefik.
@karimmirak2158
@karimmirak2158 3 жыл бұрын
There's lots of things you didn't cover in the default configuration (debug, dashboard,...) Then there's no need to cover the round robin manually when you use labels, you must read the doc carefully.
@danieljohannbutcher9927
@danieljohannbutcher9927 3 жыл бұрын
13:12 I HATE YAML I am not alone
@altimmons
@altimmons 3 жыл бұрын
Yes their doc is so bad starting out- it skips a bunch of critical steps
@Danielo515
@Danielo515 2 жыл бұрын
God bless you, but not for posting a nice tutorial from scratch, that's nice, but I'm happy about you sharing your opinions on garbage. As everything Google related or inspired, the documentation is lacky, confusing, incomplete and misleading, but still it gets popular. Another nasty thing is how they leak implementation details about their underlying language. Why can't you use single quotes like in any other place? Because GO uses that for single characters. Wtf? I don't care about your programming language syntax! do your homework! And the default behavior without no config is to yield no error and start a useless process? What a pile of garbage.
@cyanwarewolf
@cyanwarewolf Жыл бұрын
"not" is not supported 😆🤣😂😁