<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Traefik – teqqy</title><link>https://www.teqqy.de/tags/traefik/</link><description>Ein Blog über Technik und mehr</description><language>de</language><managingEditor>teqqy</managingEditor><lastBuildDate>Fri, 31 Jul 2026 22:33:33 +0000</lastBuildDate><generator>Hugo 0.164.0</generator><atom:link href="https://www.teqqy.de/tags/traefik/index.xml" rel="self" type="application/rss+xml"/><item><title>Traefik http3 aktivieren</title><link>https://www.teqqy.de/traefik-http3-aktivieren/</link><pubDate>Tue, 06 Feb 2024 00:00:00 +0000</pubDate><lastBuildDate>Tue, 06 Feb 2024 00:00:00 +0000</lastBuildDate><guid isPermaLink="true">https://www.teqqy.de/traefik-http3-aktivieren/</guid><description>Wie langjährige Leser meines Blogs oder Zuschauer meines YouTube Kanals wissen, nutze ich primär Traefik als Reverse Proxy unter Docker. Über die letzten Jahre hat sich entsprechend etwas an Know how angesammelt. Durch einen Beitrag (externer Link) auf Mastodon von Thomas Leister (externer Link) bin ich darauf gekommen auch mal http3 zu aktivieren. Was du entsprechend tun musst, um das bei dir ebenfalls einzurichten habe ich hier aufgeschrieben.</description><content:encoded>&lt;![CDATA[<p>Wie langjährige Leser meines Blogs oder Zuschauer meines YouTube Kanals wissen, nutze ich primär Traefik als Reverse Proxy unter Docker. Über die letzten Jahre hat sich entsprechend etwas an Know how angesammelt. Durch einen<a href="https://metalhead.club/@thomas/111833215602688918#." target="_blank" rel="noopener noreferrer">Beitrag<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
auf Mastodon von<a href="https://thomas-leister.de" target="_blank" rel="noopener noreferrer">Thomas Leister<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
bin ich darauf gekommen auch mal http3 zu aktivieren. Was du entsprechend tun musst, um das bei dir ebenfalls einzurichten habe ich hier aufgeschrieben.</p><h2 id="vorteile-von-http3">Vorteile von http3<a href="#vorteile-von-http3" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p><a href="https://en.wikipedia.org/wiki/HTTP/3" target="_blank" rel="noopener noreferrer">HTTP/3<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
ist die neueste Version des Hypertext Transfer Protocols (HTTP) und bringt mehrere Vorteile gegenüber seinen Vorgängerversionen, insbesondere HTTP/1.1 und HTTP/2, mit sich. Hier sind einige der wichtigsten Vorteile von HTTP/3:</p><ol><li><p><strong>Schnellerer Verbindungsaufbau:</strong> HTTP/3 verwendet das<a href="https://en.wikipedia.org/wiki/QUIC" target="_blank" rel="noopener noreferrer">QUIC<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
-Protokoll (Quick UDP Internet Connections), das auf UDP (User Datagram Protocol) basiert. Im Vergleich zu TCP (Transmission Control Protocol), das in vorherigen HTTP-Versionen verwendet wurde, ermöglicht QUIC einen schnelleren Verbindungsaufbau. Es beseitigt die Latenz, die durch den sogenannten &ldquo;Handshake&rdquo; in TCP verursacht wird.</p></li><li><p><strong>Multiplexing ohne Head-of-Line-Blocking:</strong> HTTP/3 unterstützt effizientes Multiplexing von Anfragen und Antworten. Im Gegensatz zu HTTP/1.1, bei dem eine Verbindung nur eine Anfrage gleichzeitig behandeln kann (Head-of-Line-Blocking), können bei HTTP/3 mehrere Anfragen und Antworten gleichzeitig übertragen werden. Dies verbessert die Effizienz und verkürzt die Ladezeiten von Webseiten.</p></li><li><p><strong>Bessere Leistung bei Netzwerkproblemen:</strong> HTTP/3 wurde entwickelt, um besser mit Netzwerkproblemen umzugehen. Das QUIC-Protokoll ermöglicht es, Verbindungen beizubehalten, auch wenn sich die Netzwerkbedingungen ändern. Dies trägt dazu bei, dass die Leistung aufrechterhalten wird, selbst wenn es zu Paketverlusten oder Netzwerkwechseln kommt.</p></li><li><p><strong>Adaptivität:</strong> HTTP/3 wurde entwickelt, um sich besser an verschiedene Netzwerkbedingungen anzupassen. Es kann sich automatisch an veränderte Latenzen und Bandbreiten anpassen, um eine optimale Leistung zu gewährleisten.</p></li><li><p><strong>Verbesserte Sicherheit:</strong> HTTP/3 unterstützt standardmäßig Verschlüsselung durch Transport Layer Security (TLS). Die Integration von TLS in den Kern des Protokolls trägt zur Sicherheit der Datenübertragung bei.</p></li><li><p><strong>Flexibilität:</strong> HTTP/3 ist so konzipiert, dass es besser mit den Anforderungen moderner Webanwendungen und Dienste umgehen kann. Durch die kontinuierliche Entwicklung des Protokolls können zukünftige Anforderungen besser erfüllt werden.</p></li></ol><p>Es ist wichtig zu beachten, dass die Einführung von HTTP/3 nicht nur von den Vorteilen, sondern auch von der Unterstützung auf Server- und Clientseite abhängt. Nicht alle Webserver und Browser unterstützen möglicherweise bereits HTTP/3, aber die Akzeptanz nimmt stetig zu.</p><h2 id="anpassen-der-traefik-konfiguration">Anpassen der traefik Konfiguration<a href="#anpassen-der-traefik-konfiguration" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Ich verwendet primär die<code>traefik.yml</code> Datei um alles zu konfigurieren. Nutzt du mehr Labels, musst du das natürlich umbauen. Mit traefik 2.11 und 3 muss noch die experimentelle Funktion aktiviert werden. Dies kann zu einem späterern Zeitpunkt nicht mehr notwendig sein.</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#7ee787">experimental</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">http3</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span></span></span></code></pre></div></div><p>Nun sind noch die Entrypoints anzupassen. meiner heißt<code>websecure</code> für die Verbindung von https. Entsprechend brauchen wir hier nur</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">http3</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">advertisedPort</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">'443'</span></span></span></code></pre></div></div><p>hinzuzufügen. Der vollständigkeit halber sieht mein kompletter Block so aus:</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#7ee787">entryPoints</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">ping</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">address</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">':88'</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">web</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">address</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">':80'</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">http</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">redirections</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">entryPoint</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">to</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">websecure</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">scheme</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">https</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">websecure</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">address</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">':443'</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">http</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">http3</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">advertisedPort</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">'443'</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">proxyProtocol</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">trustedIPs</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">10.0.0.0</span><span style="color:#a5d6ff">/8</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">172.16.0.0</span><span style="color:#a5d6ff">/12</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">192.168.0.0</span><span style="color:#a5d6ff">/16</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">forwardedHeaders</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">trustedIPs</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">10.0.0.0</span><span style="color:#a5d6ff">/8</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">172.16.0.0</span><span style="color:#a5d6ff">/12</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">192.168.0.0</span><span style="color:#a5d6ff">/16</span></span></span></code></pre></div></div><p>Natürlich reicht das nicht ganz aus. Wie ihr seht, veröffentliche ich Port<code>443</code> um http3 auszuliefern. Da http3 aber via QUIC über UPD kommuniziert, muss auch die<code>docker-compose.yaml</code> Datei angepasst werden.</p><p>Die Portkonfiguration sieht dann entsprechen so aus:</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">ports</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">target</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">80</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">published</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">80</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">protocol</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">tcp</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">mode</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">host</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">target</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">443</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">published</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">443</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">protocol</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">tcp</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">mode</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">host</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">target</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">443</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">published</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">443</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">protocol</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">udp</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">mode</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">host</span></span></span></code></pre></div></div><p>Der letzte<code>target</code> Block ist der wichtige. Hier wird Port 443 auf udp ausgeliefert. Abschließend noch den Container neu starten</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">bash</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="bash"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>docker compose rm -sf<span style="color:#ff7b72;font-weight:bold">&amp;&amp;</span> docker compose up -d</span></span></code></pre></div></div><p>Solltest du mehr als nur Traefik in der Datei haben, werden diese Services entsprechend auch neu gestartet. Ich empfehle zukünftig traefik zu separieren.</p>
]]></content:encoded><category>selfhosted</category><category>traefik</category><category>docker</category><category>networking</category></item><item><title>Traefik letsencrypt Tutorial</title><link>https://www.teqqy.de/traefik-letsencrypt-tutorial/</link><pubDate>Tue, 01 Feb 2022 22:49:13 +0100</pubDate><lastBuildDate>Tue, 01 Feb 2022 22:49:13 +0100</lastBuildDate><guid isPermaLink="true">https://www.teqqy.de/traefik-letsencrypt-tutorial/</guid><description>Mit diesem Traefik letsencrypt Tutorial möchte ich dir helfen einfach und sauber Zertifikate via freier CA Let’s Encrypt zu beantragen und zu verwalten. In diesem Tutorial gehe ich auf die Punkte http-challenge, dns-challenge sowie weiteres Zertifikatsmanagement ein. Sollte Dir ein Punkt fehlen, schreibe mir dazu gerne in Kommentare.
Solltest Du auf dieses Tutorial gestoßen sein, weil du Docker nutzt, kann ich dir meine docker-compose Sammlung auf GitHub (externer Link) sehr ans Herz legen. Dort sind gerade für das Thema Homelab sehr viele Softwareprodukte hinterlegt die eine direkte Traefik (externer Link) Anbindung realisieren. Sicherlich ist auch meine Traefik Konfiguration ein guter Startpunkt für ein gutes Gelingen.</description><content:encoded>&lt;![CDATA[<p>Mit diesem Traefik letsencrypt Tutorial möchte ich dir helfen einfach und sauber Zertifikate via freier CA Let’s Encrypt zu beantragen und zu verwalten. In diesem Tutorial gehe ich auf die Punkte http-challenge, dns-challenge sowie weiteres Zertifikatsmanagement ein. Sollte Dir ein Punkt fehlen, schreibe mir dazu gerne in Kommentare.</p><p>Solltest Du auf dieses Tutorial gestoßen sein, weil du Docker nutzt, kann ich dir meine<a href="https://github.com/cbirkenbeul/docker-homelab" target="_blank" rel="noopener noreferrer">docker-compose Sammlung auf GitHub<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
sehr ans Herz legen. Dort sind gerade für das Thema<a href="/mein-homelab-dashboard-2022/">Homelab</a>
sehr viele Softwareprodukte hinterlegt die eine direkte<a href="https://traefik.io" target="_blank" rel="noopener noreferrer">Traefik<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
Anbindung realisieren. Sicherlich ist auch meine Traefik Konfiguration ein guter Startpunkt für ein gutes Gelingen.</p><p><img src="https://teqqy.de/wp-content/uploads/2021/04/traefik-architecture.webp" alt="Traefik letsencrypt tutorial" loading="eager" fetchpriority="high" decoding="async"/><h2 id="traefik-grundkonfiguration">Traefik Grundkonfiguration<a href="#traefik-grundkonfiguration" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Traefik lässt sich über mehrere Wege konfigurieren. Hierbei spielt es keine Rolle ob man sämtliche Befehle und Konfigurationen direkt in die docker-compose Datei oder in separate Dateien packt. Ich für meinen Teil verwende dedizierte um eine einfachere und übersichtliche Konfiguration zu haben. Solltest du einen anderen Weg bevorzugen ist dies für dieses Traefik<a href="https://letsencrypt.org/de/" target="_blank" rel="noopener noreferrer">letsencrypt<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
Tutorial nicht wichtig. Du musst natürlich nur die Einstellungen adaptieren.</p><p>Das ist ist meine Docker Compose Beispielkonfiguration welche ich normalerweise einsetze. Je nach Umgebung kann diese aber natürlich ein wenig variieren. Ich gebe auch immer http3 mit aus, einfach weil ich es mag neue Standard direkt mit zu implentieren.</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">services</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">traefik</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">image</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik:v3</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">container_name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">volumes</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">/etc/localtime:/etc/localtime:ro</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">/etc/timezone:/etc/timezone:ro</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">/var/run/docker.sock:/var/run/docker.sock</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">/var/log/auth.log:/var/log/auth.log:ro</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">/var/log/traefik:/var/log/traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">./config:/etc/traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">networks</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">traefik_proxy</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">default</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">ports</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">target</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">80</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">published</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">80</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">protocol</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">tcp</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">mode</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">host</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">target</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">443</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">published</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">443</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">protocol</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">tcp</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">mode</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">host</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">target</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">443</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">published</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">443</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">protocol</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">udp</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">mode</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">host</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">restart</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">unless-stopped</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">networks</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">traefik_proxy</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">external</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">default</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">driver</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">bridge</span></span></span></code></pre></div></div><p>Anschließend brauchen wir natürlich noch die zwei Dateien die wir oben als Volume angegeben haben. Starten wir mit der<code>traefik.yaml</code> Diese beinhaltet alle notwenigen Eigenschaften um<a href="/interne-namensaufloesung-bei-docker-mit-traefik/">Traefik</a>
sauber ans laufen zu bekommen.</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">log</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">level</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"INFO"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">filePath</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"/var/log/traefik/traefik.log"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">accessLog</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">filePath</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"/var/log/traefik/access.log"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">bufferingSize</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">100</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">providers</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">docker</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">endpoint</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"unix:///var/run/docker.sock"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">exposedByDefault</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">false</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">network</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"traefik_proxy"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">file</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">filename</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"/etc/traefik/dynamic.yml"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">watch</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">api</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">dashboard</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">false</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">entryPoints</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">ping</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">address</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">':88'</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">web</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">address</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">':80'</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">http</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">redirections</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">entryPoint</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">to</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">websecure</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">scheme</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">https</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">websecure</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">address</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">':443'</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">http3</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">proxyProtocol</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">trustedIPs</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">10.0.0.0</span><span style="color:#a5d6ff">/8</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">172.16.0.0</span><span style="color:#a5d6ff">/12</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">192.168.0.0</span><span style="color:#a5d6ff">/16</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">forwardedHeaders</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">trustedIPs</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">10.0.0.0</span><span style="color:#a5d6ff">/8</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">172.16.0.0</span><span style="color:#a5d6ff">/12</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">192.168.0.0</span><span style="color:#a5d6ff">/16</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">certificatesResolvers</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">default</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">acme</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">email</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"deine@email-adresse.example"</span><span style="color:#6e7681"/><span style="color:#8b949e;font-style:italic">#Email Adresse hier anpassen</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">storage</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"/etc/traefik/ACME/acme.json"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">httpChallenge</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">entryPoint</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">web</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">tls_resolver</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">acme</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">email</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"deine@email-adresse.example"</span><span style="color:#6e7681"/><span style="color:#8b949e;font-style:italic">#Email Adresse hier anpassen</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">storage</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"/etc/traefik/ACME/acme.json"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">tlsChallenge</span>:<span style="color:#6e7681"/>{}</span></span></code></pre></div></div><p>Gehen wir die Punkt einmal durch:</p><h3 id="log">[log]<a href="#log" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Das Loglevel sollte für den produktiven Betrieb so gewählt werden, dass nach Möglichkeit nicht die Festplatte voll läuft. Für den Beginn ist es evtl. ratsam hier auf<strong>DEBUG</strong> umzustellen um mehr zu sehen und um Fehler leichter erkennen zu können.</p><h3 id="providers">[providers]<a href="#providers" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Wir nutzen für diese Beispielkonfiguration Docker. Wir möchten allerdings nicht, dass grundsätzlich alle<a href="/docker-befehle-fuer-den-alltag/">Docker</a>
Container via Traefik veröffentlicht werden (exposedByDefault = false) und setzen die jeweiligen Anpassungen für jeden Container dediziert. Traefik lassen wir auf den Docker Socket hören um zu wissen was Traefik so machen muss. Gegebenenfalls musst du den Parameter „network“ anpassen. Ich nutze hierfür immer „traefik_proxy“ als Netzwerk. Möchtest du das ebenfalls nutzen musst du</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">bash</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="bash"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>docker network create traefik_proxy</span></span></code></pre></div></div><p>ausführen und das Netzwerk anzulegen.</p><h3 id="api">[api]<a href="#api" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Das Dashboard brauchen wir hierfür nicht, wird also deaktiviert</p><h3 id="entrypoints">[entryPoints]<a href="#entrypoints" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Die entryPoints sind die Ports und Protokolle auf die Traefik hört. Stand jetzt kann Traefik nur HTTP/HTTPS Traffic. Weitere Protokolle sollen in Zukunft kommen. Wir lauschen natürlich auch auf Port 80 (HTTP) und machen eine direkte Weiterleitung auf Port 443 (HTTPS). Unverschlüsselte Kommunikation sollte nur in Ausnahmefällen noch erlaubt sein.</p><p>Wie du siehst binden wir auch eine dynamic.yml Datei ein. Diese hat folgenden Aufbau</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">tls</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">options</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">default</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">minVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">VersionTLS12</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">cipherSuites</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">TLS_AES_128_GCM_SHA256</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">TLS_AES_256_GCM_SHA384</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">TLS_CHACHA20_POLY1305_SHA256</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">curvePreferences</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">CurveP521</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">CurveP384</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">sniStrict</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">http</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">middlewares</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">default</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">chain</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">middlewares</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">default-security-headers</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">gzip</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">default-security-headers</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">headers</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">browserXssFilter</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">contentTypeNosniff</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">forceSTSHeader</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">frameDeny</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">stsIncludeSubdomains</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">stsPreload</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">stsSeconds</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">31536000</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">customFrameOptionsValue</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"SAMEORIGIN"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">gzip</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">compress</span>:<span style="color:#6e7681"/>{}</span></span></code></pre></div></div><p>Die dynamic.yml ist zur Konfiguration aller Sicherheitsmerkmale gedacht. Bitte passe diese nach den aktuellen Gegebenheiten an, da sich gerade die Cipher Suites häufig ändern können! Die restlichen Werte sind nach langjähriger Erfahrung von mir so zusammen getragen und müssen nicht dem aktuellen Sicherheitsstandards entsprechend. Für Tipps bin ich aber dankbar und passe die Datei dann gerne an.</p><h2 id="traefik-letsencrypt-tlschallenge">Traefik letsencrypt tlsChallenge<a href="#traefik-letsencrypt-tlschallenge" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Mit der tlsChallange ist es wahrscheinlich die einfachste Variante Zertifikate via Let’s encrypt zu beantragen. Hier kann Traefik direkt so konfiguriert, bzw. über die Docker Konfiguration so eingerichtet werden, dass nur Port 443, also HTTPS, veröffentlicht werden muss. Möchte man nur ein paar wenige Zertifikate beantragen ist das meiner Meinung die empfehlenswerte Version.</p><p>Die Konfiguration der tlsChallenge ist ziemlich einfach. Man fügt in der traefik.toml Datei folgende Zeilen am Ende ein:</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#7ee787">certificatesResolvers</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">default</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">acme</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">email</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"deine@email-adresse.example"</span><span style="color:#6e7681"/><span style="color:#8b949e;font-style:italic">#Email Adresse hier anpassen</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">storage</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"/etc/traefik/ACME/acme.json"</span></span></span></code></pre></div></div><p>Email-Adresse ist für die Benachrichtigung von Let’s encrypt an dich gedacht. Entsprechend empfehle ich hier eine valide Email-Adresse anzugeben. Die Storage Angabe ist der Speicherort der Zertifikate. Entsprechend muss in der Docker Konfiguration auch das beachtet werden.</p><h2 id="traefik-letsencrypt-httpchallenge">Traefik letsencrypt httpChallenge<a href="#traefik-letsencrypt-httpchallenge" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Die httpChallenge ist quasi das gleich wie die tlsChallenge, allerdings via Port 80 anstatt 443. Hier muss als in der Docker Konfiguration auch Port 80 veröffentlicht werden. So ergibt sich daraus folgender Inhalt für die traefik.toml:</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#7ee787">certificatesResolvers</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">default</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">acme</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">email</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"deine@email-adresse.example"</span><span style="color:#6e7681"/><span style="color:#8b949e;font-style:italic">#Email Adresse hier anpassen</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">storage</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"/etc/traefik/ACME/acme.json"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">httpChallenge</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">entryPoint</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">web</span></span></span></code></pre></div></div><h2 id="traefik-letsencrypt-dnschallenge-am-beispiel-cloudflare">Traefik letsencrypt dnsChallenge (am Beispiel Cloudflare)<a href="#traefik-letsencrypt-dnschallenge-am-beispiel-cloudflare" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Die dnsChallenge ist quasi die Königsdisziplin. Allerdings nur wirklich dann sinnvoll wenn man z. B. Wildcard Zertifikate benötig oder wenn man viele Subdomainzertifikate benötigt. Entsprechend muss man hier auch ein wenig mehr konfigurieren und vor allen Dingen benötigt man einen DNS Provider der von Let’s encrypt unterstützt wird. Ich empfehle hier Cloudflare.</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#7ee787">certificatesResolvers</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">default</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">acme</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">email</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"mail@teqqy.de"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">storage</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"/etc/traefik/ACME/acme.json"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">dnsChallenge</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">provider</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"cloudflare"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">resolvers</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">"1.1.1.1:53"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">"1.0.0.1:53"</span></span></span></code></pre></div></div><p>Hinzu kommt, dass wir in der<code>docker-compose.yaml</code> noch den API Token für die Cloudflare API hinzufügen. Dazu einfach noch folgende Zeilen einfügen:</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">environment</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">CF_DNS_API_TOKEN</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">"{STRENGGEHEIMERAPIKEY}"</span></span></span></code></pre></div></div><p><img src="/traefik-letsencrypt-tutorial/images/traefik-letsencrypt-cloudflare-api-key_hu_258edc5025bb9e7.webp" srcset="/traefik-letsencrypt-tutorial/images/traefik-letsencrypt-cloudflare-api-key_hu_8da039c58f354eb1.webp 384w, /traefik-letsencrypt-tutorial/images/traefik-letsencrypt-cloudflare-api-key_hu_258edc5025bb9e7.webp 768w" sizes="(max-width: 768px) 100vw, 768px" alt="Screenshot Cloudflare API Key Übersicht" loading="lazy" fetchpriority="auto" decoding="async" width="768" height="396"/><h2 id="zertifikate-löschen">Zertifikate löschen<a href="#zertifikate-l%c3%b6schen" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Zertifikate werden in der<strong>acme.json</strong> Datei gespeichert und könnten dort heraus gelöscht werden. Zu jedem Zertifikat gibt es eine<strong>certificate</strong> und<strong>key</strong> Definition. Man kann also die Datei entsprechend editieren und die Zeichenketten entsprechend heraus löschen.</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">json</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="json"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-json" data-lang="json"><span style="display:flex;"><span> {</span></span><span style="display:flex;"><span><span style="color:#7ee787">"domain"</span>: {</span></span><span style="display:flex;"><span><span style="color:#7ee787">"main"</span>:<span style="color:#a5d6ff">"teqqy.de"</span>,</span></span><span style="display:flex;"><span><span style="color:#7ee787">"sans"</span>: [</span></span><span style="display:flex;"><span><span style="color:#a5d6ff">"www.teqqy.de"</span></span></span><span style="display:flex;"><span> ]</span></span><span style="display:flex;"><span> },</span></span><span style="display:flex;"><span><span style="color:#7ee787">"certificate"</span>:<span style="color:#a5d6ff">"&lt;Zeichenkette&gt;"</span>,</span></span><span style="display:flex;"><span><span style="color:#7ee787">"key"</span>:<span style="color:#a5d6ff">"&lt;Zeichenkette&gt;"</span>,</span></span><span style="display:flex;"><span><span style="color:#7ee787">"Store"</span>:<span style="color:#a5d6ff">"default"</span></span></span><span style="display:flex;"><span> }<span style="color:#f85149">,</span></span></span></code></pre></div></div><p>Notwendig ist dies aber nur dann, wenn bei der Erstellung ein Fehler aufgetreten ist oder Let’s Encrypt Zertifikate wg. Fehlern zurückruft. Andernfalls laufen die Zertifikate automatisch nach 90 Tagen ab. Ein manuelles Aufräumen ist nicht notwendig.</p>
]]></content:encoded><category>selfhosted</category><category>traefik</category><category>ssl-tls</category><category>docker</category><category>cloudflare</category></item><item><title>Traefik Troubleshooting Guide</title><link>https://www.teqqy.de/traefik-troubleshooting-guide/</link><pubDate>Wed, 07 Apr 2021 15:29:13 +0200</pubDate><lastBuildDate>Wed, 07 Apr 2021 15:29:13 +0200</lastBuildDate><guid isPermaLink="true">https://www.teqqy.de/traefik-troubleshooting-guide/</guid><description>In allen meiner Tutorials verwende ich Traefik als Reverse Proxy für Docker Container, so natürlich auch auf meinem YouTube Kanal (externer Link) . Im Laufe der Zeit fragen immer wieder Leser und Zuschauer ob ich ihnen bei ihrem Problem helfen kann. Dies mache ich natürlich gerne. Für ein gewisse Selbsthilfe möchte ich dir allerdings diesen Traefik Troubleshooting Guide an die Hand geben.</description><content:encoded>&lt;![CDATA[<p>In allen meiner Tutorials verwende ich Traefik als<a href="/reverse-proxy-mit-traefik-unter-docker/">Reverse Proxy</a>
für Docker Container, so natürlich auch auf meinem<a href="http://youtube.com/teqqyde" target="_blank" rel="noopener noreferrer">YouTube Kanal<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
. Im Laufe der Zeit fragen immer wieder Leser und Zuschauer ob ich ihnen bei ihrem Problem helfen kann. Dies mache ich natürlich gerne. Für ein gewisse Selbsthilfe möchte ich dir allerdings diesen Traefik Troubleshooting Guide an die Hand geben.</p><h2 id="vorbereitende-maßnahmen">Vorbereitende Maßnahmen<a href="#vorbereitende-ma%c3%9fnahmen" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Um mit einem guten Troubeshooting zu beginnen möchte ich zwei Maßnahmen vorweg greifen. Diese helfen dir ein paar Dinge auszuschließen bzw. eventuell schnell selbst auf eine Lösung zu kommen.</p><p><img src="/traefik-troubleshooting-guide/images/traefik-troubleshooting_hu_c55681aa534d7e0e.webp" srcset="/traefik-troubleshooting-guide/images/traefik-troubleshooting_hu_4c9f0ac2d543e280.webp 384w, /traefik-troubleshooting-guide/images/traefik-troubleshooting_hu_c55681aa534d7e0e.webp 768w" sizes="(max-width: 768px) 100vw, 768px" alt="Traefik Troubleshooting" loading="eager" fetchpriority="high" decoding="async" width="768" height="509"/><h2 id="container-richtig-neu-starten">Container richtig neu starten<a href="#container-richtig-neu-starten" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Wenn ihr Änderungen am Container von Traefik oder gar an den Konfigurationsdateien vornimmt, muss Traefik komplett neu gestartet werden. Ein stoppen des jeweiligen ist nicht ausreichend. Bei<a href="https://github.com/cbirkenbeul/docker-homelab" target="_blank" rel="noopener noreferrer">meinen Compose Dateien<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
verwende also bitte nach dem stoppen noch ein</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">bash</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="bash"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>docker-compose rm</span></span></code></pre></div></div><p>um diesen komplett zu löschen. Anschließend kannst du den Container wieder starten und eine neue Konfiguration ist übernommen.</p><h2 id="erhöhen-des-log-levels">Erhöhen des Log Levels<a href="#erh%c3%b6hen-des-log-levels" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Zum Traefik Troubleshooting gehört auf jeden Fall auch das betrachten der Log Dateien. In meiner Vorlage steht das Logging auf einer sehr kleinen Stufe um nicht unnötig Speicherplatz zu benötigen. Wenn du mit Traefik startest empfehle ich dir, dieses auf debug zu stellen.</p><p>Hierzu einfach die traefik.toml Datei anpassen:</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">conf</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="conf"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code class="language-conf" data-lang="conf">[log]
level = "DEBUG"</code></pre></div><h2 id="fehlerlösungen">Fehlerlösungen<a href="#fehlerl%c3%b6sungen" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><h3 id="die-webseite-wird-als-nicht-sicher-angezeigt">Die Webseite wird als nicht sicher angezeigt<a href="#die-webseite-wird-als-nicht-sicher-angezeigt" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Dieser Fehler entsteht zumeist wenn Traefik kein<a href="https://letsencrypt.org" target="_blank" rel="noopener noreferrer">Let’s Encrypt<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
Zertifikat abrufen konnte. Leider kann das mehrere Ursachen haben:</p><h3 id="zu-häufiges-abrufen-von-zertifikaten">Zu häufiges Abrufen von Zertifikaten<a href="#zu-h%c3%a4ufiges-abrufen-von-zertifikaten" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Im Log steht hier meist, dass die Anzahl der Möglichen Erstellversuche von Zertifikaten erreicht ist. LE lässt es nur zu 10 Versuche binnen 24 Stunden auf ein SSL-Zertifikat zu erstellen. Wenn du eine eigene Domain hast, versuche es mit einer anderen Subdomain erneut. Andernfalls hilft nur warten.</p><h3 id="ein-anderer-container-hört-auf-port-80">Ein anderer Container hört auf Port 80<a href="#ein-anderer-container-h%c3%b6rt-auf-port-80" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Let’s Encrypt nutzt bei der ersten Kommunikation zwischen Server und Client auch HTTP (Port 80). Wenn dieser Port also noch durch einen anderen Container geblockt ist kann keine Verbindung aufgebaut werden. Ebenso könnte es sein, dass dein NAT in deinem Router Port 80 noch nicht weiter leitet.</p><h3 id="eine-404-seite-wird-angezeigt">Eine 404-Seite wird angezeigt<a href="#eine-404-seite-wird-angezeigt" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Jetzt wird es spannend. Sobald eine 404-Seite angezeigt wird, gibts nämlich ein Problem mit dem Routing zu den Containern. Folgende Dinge kannst du hier prüfen:</p><ul><li>Wird der korrekte Port weiter geleitet?</li><li>Stimmen alle Middlewere-Configs überein?</li></ul>
]]></content:encoded><category>selfhosted</category><category>traefik</category><category>docker</category><category>ssl-tls</category></item><item><title>k3s Cluster installieren mit MetalLB und Traefik</title><link>https://www.teqqy.de/k3s-cluster-installieren-mit-metallb-und-traefik/</link><pubDate>Tue, 02 Feb 2021 15:48:40 +0100</pubDate><lastBuildDate>Tue, 02 Feb 2021 15:48:40 +0100</lastBuildDate><guid isPermaLink="true">https://www.teqqy.de/k3s-cluster-installieren-mit-metallb-und-traefik/</guid><description>k3s ist eine schlanke Variante zum vollen Kubernetes (k8s) Stack. Der k3s (externer Link) Cluster lässt sich daher mit wenigen Schritten installieren und einrichten. Dieses Tutorial beschreibt dir wie du den k3s Cluster installieren kannst.
Voraussetzungen Für dieses Tutorial gibt es ein paar Voraussetzungen:</description><content:encoded>&lt;![CDATA[<p>k3s ist eine schlanke Variante zum vollen Kubernetes (k8s) Stack. Der<a href="https://k3s.io" target="_blank" rel="noopener noreferrer">k3s<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
Cluster lässt sich daher mit wenigen Schritten installieren und einrichten. Dieses Tutorial beschreibt dir wie du den k3s Cluster installieren kannst.</p><h2 id="voraussetzungen">Voraussetzungen<a href="#voraussetzungen" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Für dieses Tutorial gibt es ein paar Voraussetzungen:</p><ul><li>Mindestens zwei Linux Systeme (egal ob VM oder<a href="https://amzn.to/2Ot3HOL" target="_blank" rel="noopener noreferrer">Raspberry Pi<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
) mit mind. 2 Kernen und 1 GB RAM</li><li>Grundlegende Kenntnisse von Linux</li><li>Die Fähigkeit Tutorials komplett zu lesen (entschuldige den Sarkasmus)</li></ul><h2 id="vorbereitungen">Vorbereitungen<a href="#vorbereitungen" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Solltest du eine VM verwenden, musst du nichts weiter vorbereiten als dein System auf den aktuellen Stand zu patchen. Zudem wäre es empfehlenswert, wenn du feste IP-Adressen verwenden würdest. Andernfalls kannst du natürlich auch die Kommunikation via DNS machen, dann benötigst du aber ein zuverlässiges DNS!</p><p>Solltest du allerdings einen<a href="https://amzn.to/2Ot3HOL" target="_blank" rel="noopener noreferrer">Raspberry Pi<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
verwenden müssen wir noch etwas am boot Prozess einstellen. Und zwar erweitern wir die cmdline.txt Datei. Diese liegt bei Rasbian und Ubuntu (ja auch das gibts für den<a href="https://amzn.to/2Ot3HOL" target="_blank" rel="noopener noreferrer">RPi<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
) unter verschiedenen Orten:</p><p>Rasbian</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>sudo vim /boot/cmdline.txt</code></pre></div><p>Ubuntu</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>sudo vim /boot/firmware/cmdline.txt</code></pre></div><p>Am Ende der Zeile fügen wir noch folgendes ein</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>cgroup_enable=1 cgroup_memory=1 cgroup_enable=memory</code></pre></div><p>Solltest du das bei den Raspberry Pis nicht tun, wird k3s nicht starten!</p><h2 id="k3s-cluster-installieren">k3s Cluster installieren<a href="#k3s-cluster-installieren" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><h3 id="master-installieren">Master installieren<a href="#master-installieren" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Fangen wir mir dem Master an. Dieser lässt sich quasi mit copy &amp; paste von der k3s.io Webseite kopieren. Allerdings wollten wir ja die Installation ein wenig anpassen. Wir verwenden z. B. MetalLB als Cluster Load Balancer um IP Adressen aus dem normalen Netzbereich unseres Netzwerkes zu verwenden. Zudem bin ich ein Fan von Traefik. Zwar kommt der k3s Cluster im Standard schon mit Traefik daher, allerdings wollen wir die Funktion erweitern. Entsprechend müssen wir die Installation ein wenig abändern.</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>curl -sfL https://get.k3s.io | sh -s - --disable traefik --disable servicelb</code></pre></div><p>Nach ein paar Augenblicken sollte der Cluster soweit sein. Wir kontrollieren das mit</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>kubectl get nodes</code></pre></div><p>Und sollten eine Node sehen die den Status ready hat.</p><h3 id="agenten-hinzufügen">Agenten hinzufügen<a href="#agenten-hinzuf%c3%bcgen" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Diesen Schritt wiederholst du entsprechend so oft wie viele Agenten du zu dem Cluster hinzufügen möchtest.</p><p>Allerdings benötigen wir als erstes deinen Token um die verschlüsselte Kommunikation zu erlauben. Diesen lesen wir wie folgt aus</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>cat /var/lib/rancher/k3s/server/node-token</code></pre></div><p>Es erscheint eine lange Zeile aus Buchstaben und Zahlen z. B.</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>K10c8c26950c31536167a7a38f11979060f977cf33cfe10a5e7b130e057a8e1d4df::server:de0d941e347301d8ac112e4c2ef2826b</code></pre></div><p>Natürlich sieht das bei dir anders aus, daher ist ein einfaches kopieren aller Befehle in diesem Tutorial<strong>nicht</strong> möglich.</p><p>Nun verbinden wir die Agenten mit dem Master</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>curl -sfL https://get.k3s.io | K3S_URL=https://{IP-Server}:6443 K3S_TOKEN={Token} sh -</code></pre></div><p>Passe bitte die zwei Variablen in dem Befehl an deine Gegebenheiten an.</p><p>Auf dem Master führen wir nun den Befehl</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>kubectl get nodes --watch</code></pre></div><p>aus. Nach ein paar Augenblicken sollte der Agent dort erscheinen und nach ein paar weiteren in den Status Ready wechseln.</p><p>Da jetzt der Cluster läuft, können wir uns um MetalLB kümmern.</p><h2 id="metallb-installieren">MetalLB installieren<a href="#metallb-installieren" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>MetalLB ist wie gesagt ein LoadBalancer um Anfragen über den Cluster zu verteilen. Wir werden MetalLB als Layer2 LB verwenden. Alternativen für Menschen mit mehr Netzwerkkenntnissen wären z. B. noch BGP. Layer2 reicht aber für das Homelab und benötigt keine spezielle Konfiguration an Firewall und/oder Switchen.</p><p>Die Version des Programmes ändert sich natürlich fortlaufend. Entsprechend ist zu beachten, dass du in den Befehlen die Version auf den neusten Stand bringst. Am besten ist, du wirfst immer vorher ein Blick in die offizielle<a href="https://metallb.universe.tf/installation/#installation-by-manifest" target="_blank" rel="noopener noreferrer">Dokumentation<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
.</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.5/manifests/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.5/manifests/metallb.yaml
# On first install only
kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"</code></pre></div><p>Ein paar Sekunden später ist die Grundarbeit erledigt. Jetzt legen wir noch den IP-Bereich fest, den MetalLB zur Verfügung hat. Dazu erstellen wir uns eine kleine Datei</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>vim ConfigMap.yaml</code></pre></div><p>und fügen folgenden Inhalt ein</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">apiVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">v1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ConfigMap</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">namespace</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">metallb-system</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">configdata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">config</span>:<span style="color:#6e7681"/>|<span style="color:#a5d6ff"/></span></span><span style="display:flex;"><span><span style="color:#a5d6ff"> address-pools:</span></span></span><span style="display:flex;"><span><span style="color:#a5d6ff"> - name: default</span></span></span><span style="display:flex;"><span><span style="color:#a5d6ff"> protocol: layer2</span></span></span><span style="display:flex;"><span><span style="color:#a5d6ff"> addresses:</span></span></span><span style="display:flex;"><span><span style="color:#a5d6ff"> - 192.168.10.50-192.168.10.59</span></span></span></code></pre></div></div><p>Den IP-Bereich unten passt du bitte so an, dass er bei dir passt!</p><p>Last but not leased benötigen wir noch einen reverse proxy. Wie immer bei mir: Traefik.</p><h2 id="traefik-installieren">Traefik installieren<a href="#traefik-installieren" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Für Traefik verwenden wir zwei sogenannte Manifest Dateien. Erste Datei:</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>vim CustomRessourceDefinition.yaml</code></pre></div><p>Und da rein kommt folgender langer Inhalt</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">apiVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">apiextensions.k8s.io/v1beta1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">CustomResourceDefinition</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ingressroutes.traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">spec</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">group</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">version</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">v1alpha1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">names</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">IngressRoute</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">plural</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ingressroutes</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">singular</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ingressroute</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">scope</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">Namespaced</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">apiVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">apiextensions.k8s.io/v1beta1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">CustomResourceDefinition</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">middlewares.traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">spec</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">group</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">version</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">v1alpha1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">names</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">Middleware</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">plural</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">middlewares</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">singular</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">middleware</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">scope</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">Namespaced</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">apiVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">apiextensions.k8s.io/v1beta1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">CustomResourceDefinition</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ingressroutetcps.traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">spec</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">group</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">version</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">v1alpha1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">names</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">IngressRouteTCP</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">plural</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ingressroutetcps</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">singular</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ingressroutetcp</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">scope</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">Namespaced</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">apiVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">apiextensions.k8s.io/v1beta1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">CustomResourceDefinition</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ingressrouteudps.traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">spec</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">group</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">version</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">v1alpha1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">names</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">IngressRouteUDP</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">plural</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ingressrouteudps</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">singular</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ingressrouteudp</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">scope</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">Namespaced</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">apiVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">apiextensions.k8s.io/v1beta1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">CustomResourceDefinition</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">tlsoptions.traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">spec</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">group</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">version</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">v1alpha1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">names</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">TLSOption</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">plural</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">tlsoptions</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">singular</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">tlsoption</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">scope</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">Namespaced</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">apiVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">apiextensions.k8s.io/v1beta1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">CustomResourceDefinition</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">tlsstores.traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">spec</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">group</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">version</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">v1alpha1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">names</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">TLSStore</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">plural</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">tlsstores</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">singular</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">tlsstore</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">scope</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">Namespaced</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">apiVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">apiextensions.k8s.io/v1beta1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">CustomResourceDefinition</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefikservices.traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">spec</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">group</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">version</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">v1alpha1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">names</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">TraefikService</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">plural</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefikservices</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">singular</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefikservice</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">scope</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">Namespaced</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ClusterRole</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">apiVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">rbac.authorization.k8s.io/v1beta1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik-ingress-controller</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">rules</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">api</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">Groups</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">""</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">resources</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">services</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">endpoints</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">secrets</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">verbs</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">get</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">list</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">watch</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">apiGroups</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">extensions</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">resources</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">ingresses</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">verbs</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">get</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">list</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">watch</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">apiGroups</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">extensions</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">resources</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">ingresses/status</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">verbs</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">update</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">apiGroups</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">traefik.containo.us</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">resources</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">middlewares</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">ingressroutes</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">traefikservices</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">ingressroutetcps</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">ingressrouteudps</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">tlsoptions</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">tlsstores</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">verbs</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">get</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">list</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">watch</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ClusterRoleBinding</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">apiVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">rbac.authorization.k8s.io/v1beta1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik-ingress-controller</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">roleRef</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">apiGroup</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">rbac.authorization.k8s.io</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ClusterRole</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik-ingress-controller</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">subjects</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ServiceAccount</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik-ingress-controller</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">namespace</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">default</span></span></span></code></pre></div></div><p>Hiermit werden alle benötigen Clusterweiten Ressourcen und Abhängigkeiten eingerichtet. Anschließend brauchen wir natürlich noch den Container selbst.</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>vim Deployment.yaml</code></pre></div><p>mit folgendem Inhalt</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">apiVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">v1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">Service</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">spec</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">ports</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">protocol</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">TCP</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">web</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">port</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">80</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">protocol</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">TCP</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">admin</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">port</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">8080</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">protocol</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">TCP</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">websecure</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">port</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">443</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">type</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">LoadBalancer</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">selector</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">app</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">apiVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">v1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">ServiceAccount</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">namespace</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">kube-system</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik-ingress-controller</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">apiVersion</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">apps/v1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">kind</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">Deployment</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">namespace</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">kube-system</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">labels</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">app</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">spec</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">replicas</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">1</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">selector</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">matchLabels</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">app</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">template</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">metadata</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">labels</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">app</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">spec</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">serviceAccountName</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik-ingress-controller</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">containers</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">image</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik:v2.3</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">args</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>- --<span style="color:#a5d6ff">api.insecure</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>- --<span style="color:#a5d6ff">accesslog</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>- --<span style="color:#a5d6ff">entrypoints.web.Address=:80</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>- --<span style="color:#a5d6ff">entrypoints.websecure.Address=:443</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>- --<span style="color:#a5d6ff">providers.kubernetescrd</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>- --<span style="color:#a5d6ff">certificatesresolvers.myresolver.acme.tlschallenge</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>- --<span style="color:#a5d6ff">certificatesresolvers.myresolver.acme.email=mail@example.com</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>- --<span style="color:#a5d6ff">certificatesresolvers.myresolver.acme.storage=acme.json</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">ports</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">web</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">containerPort</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">80</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">websecure</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">containerPort</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">443</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#7ee787">name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">admin</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">containerPort</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">8080</span></span></span></code></pre></div></div><p>Nach kurzer Zeit sollte der Container auch erscheinen und den Status Ready bekommen</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>kubectl get pods --watch</code></pre></div><p>Als letztes kontrollieren wir noch ob Traefik auch eine IP-Adresse aus dem LoadBalancer Bereich erhalten hat</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>kubectl get svc</code></pre></div><p>Hier sollten wir eine Zeile ähnlich zu dieser haben</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
traefik LoadBalancer 10.43.43.165 192.168.10.50 80:32049/TCP,8080:31750/TCP,443:31764/TCP 18h</code></pre></div><p>Jetzt kannst du beginnen entsprechende Workload auf deinen Cluster zu bringen. Allerdings derzeit nur mit lokalem Storage. In weiteren Beiträgen werde ich noch Storagemöglichkeiten beschreiben.</p>
]]></content:encoded><category>selfhosted</category><category>kubernetes</category><category>traefik</category><category>homelab</category></item><item><title>Nextcloud Docker Setup - Step by step zum Erfolg</title><link>https://www.teqqy.de/nextcloud-docker-tutorial-step-by-step-zum-erfolg/</link><pubDate>Wed, 15 Apr 2020 10:38:31 +0200</pubDate><lastBuildDate>Wed, 15 Apr 2020 10:38:31 +0200</lastBuildDate><guid isPermaLink="true">https://www.teqqy.de/nextcloud-docker-tutorial-step-by-step-zum-erfolg/</guid><description>Vor einiger Zeit gab es von mir ein Nextcloud Docker Setup Tutorial bereits auf meinem YouTube Kanal. (externer Link) Dies ist soweit auch weiterhin aktuell. Allerdings bedarf es für eine gute Nextcloud Installation noch weiterer Konfiguration.
Um Nextcloud immer von überall aus erreichen zu können, empfehle ich dir die Installation auf einem virtuellen Server bei einem Hosting Provider. Ich nutze hierfür Netcup, welche ich sehr empfehlen kann.</description><content:encoded>&lt;![CDATA[<p>Vor einiger Zeit gab es von mir ein Nextcloud Docker Setup Tutorial bereits auf meinem<a href="https://youtube.com/teqqyde" target="_blank" rel="noopener noreferrer">YouTube Kanal.<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
Dies ist soweit auch weiterhin aktuell. Allerdings bedarf es für eine gute Nextcloud Installation noch weiterer Konfiguration.</p><p>Um Nextcloud immer von überall aus erreichen zu können, empfehle ich dir die Installation auf einem virtuellen Server bei einem Hosting Provider. Ich nutze hierfür Netcup, welche ich sehr empfehlen kann.</p><h2 id="nextcloud-docker-setup-als-video">Nextcloud Docker Setup als Video<a href="#nextcloud-docker-setup-als-video" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Mit diesem Video hast du das Basissetup von Nextcloud. Jetzt werden wir das ganz noch etwas besser einrichten und vor allen Dingen die Warnungen aus dem Administrationsbereich beseitigen.</p><div class="video-embed" data-src="https://www.youtube-nocookie.com/embed/wlZ685wGH34?autoplay=1&rel=0"><button class="video-embed-trigger" type="button" data-umami-event="Video Load" data-umami-event-provider="YouTube" data-umami-event-id="wlZ685wGH34"><svg class="video-embed-play-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" width="48" height="48"><circle cx="12" cy="12" r="12" fill="rgba(0,0,0,0.6)"/><path d="M9.5 7.5l7 4.5-7 4.5V7.5z" fill="white"/></svg><span class="video-embed-title">YouTube Video</span><span class="video-embed-note">YouTube &middot; Klicken zum Laden</span></button></div><p>Wenn du Nextcloud nicht in deinem Homelab selbst hosten möchtest, empfehle ich dir Netcup als Hostingunternehmen. Meine langjährige Erfahrung mit Netcup hat mit gelehrt das ein zuverlässiger Partner im Bereich Hosting Gold wert ist. Auch wenn das manchmal ein paar Euro im Jahr mehr kostet.</p><h3 id="aktuelle-compose-datei-verwenden">Aktuelle Compose Datei verwenden<a href="#aktuelle-compose-datei-verwenden" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Meine<a href="https://github.com/cbirkenbeul/docker-homelab" target="_blank" rel="noopener noreferrer">Docker Compose Dateien<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
ändern sich zwischendurch. Beachte also bitte, dass du die aktuellen Dateien verwendest. Dieses Tutorial ist für<a href="/traefik-troubleshooting-guide/">Traefik</a>
als reverse proxy ausgelegt. Solltest du etwas anderes nutzen wollen, musst du dir diverse Einstellungen herleiten. Gerade auch die Traefik Konfiguration ändert sich, gerade was die Sicherheitseinstellungen angeht, auch. Bitte updatete daher gegebenenfalls auch diese.</p><h3 id="installation-durchführen">Installation durchführen<a href="#installation-durchf%c3%bchren" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Nun kannst du die Installation, wie im Video beschrieben, durchführen. Ich gehe entsprechend davon aus, dass du jetzt eine funktionsfähige Installation hast.</p><h3 id="reverse-proxy-konfiguration">Reverse Proxy Konfiguration<a href="#reverse-proxy-konfiguration" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Nextcloud möchte, dass wir die notwendigen Einstellungen vornehmen um der Installation die reverse proxy Konfiguration mitzugeben. Als erstes benötigen wir die IP Adresse in<a href="https://de.wikipedia.org/wiki/Classless_Inter-Domain_Routing" target="_blank" rel="noopener noreferrer">CIDR<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
Notation unseres Traefik Containers</p><p>~~bash
docker inspect traefik</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>Nun rattern ein paar Zeilen config durchs Bild. Interessant ist für uns eigentlich nur der letzte Abschnitt:</code></pre></div><pre><code> "traefik_proxy": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"0d9ab883d62e",
"traefik"
],
"NetworkID": "b23ae2baa87df4b02c1cbed4679c8ea3c4ef4d2b8c8d05efb4b0bf0d94ced7f2",
"EndpointID": "44b9f2e00a25177f6084ecfa270df6be9cc75430ed64609ce60897fda8ca67b6",
"Gateway": "172.19.0.1",
"IPAddress": "172.19.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:13:00:04",
"DriverOpts": null
}</code></pre><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>Diese Informationen sind häufig unterschiedlich. Du solltest also meine Werte nicht einfach blind übernehmen. Aus dem obrigen Teil benötigen wir die Punkte „IPAddress“ und „IPPrefixLen“.
Damit editieren wir nun die config.php Datei unserer Nextcloud Installation und passen diese im Bereich „trused\_proxies“ an. Die Angabe setzt sich also aus IP-Adresse mit anschließender Netzgröße zusammen.</code></pre></div><p>&rsquo;trusted_proxies&rsquo; =&gt; &lsquo;172.19.0.4/16&rsquo;</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>### Datenbank Optimierungen durchführen
Die Übersichtsseite möchte das wir noch ein paar Änderungen in der Datenbank durchführen. Dieses machen wir, indem wir uns mit einem „docker exec“ Befehl kurz in den Container verbinden und den notwendigen Befehl der Nextcloud CLI durchführen. Beide Befehle solltest du nach Möglichkeit vor weiterer Einrichtung und Benutzung von Nextcloud durchführen. Andernfalls können diese Befehle einige Zeit in Anspruch nehmen.
~~~bash
docker exec --user www-data nextcloud-app php occ db:add-missing-indicesdocker exec --user www-data nextcloud-app php occ db:convert-filecache-bigint</code></pre></div><p>Beide Befehle brauchen jeweils einen kurzen Moment. Je nach Leistung deines Servers.</p><h3 id="nextcloud-client-einstellungen-anpassen">Nextcloud Client Einstellungen anpassen<a href="#nextcloud-client-einstellungen-anpassen" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Damit wir den Nextcloud Client benutzen können, musste ich noch ein paar weitere Einstellungen an der config.php durchführen. Ändere die Option „overwrite.cli.uri“ ab und füge noch zwei Zeilen hinzu:</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code> 'overwrite.cli.url' =&gt; 'https://nextcloud.example.com', 'overwriteprotocol' =&gt; 'https', 'overwritehost' =&gt; 'nextcloud.example.com',</code></pre></div><p>Natürlich musst du die jeweiligen URLs an deine Installation anpassen.</p><h3 id="container-sauber-neu-starten">Container sauber neu starten<a href="#container-sauber-neu-starten" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h3><p>Damit dieses Nextcloud Docker Tutorial auch wirklich funktioniert müssen wir anschließend unsere Container komplett neu starten. Erst einmal beenden wir alles</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">bash</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="bash"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>docker compose stop</span></span></code></pre></div></div><p>und anschließend löschen wir die Container, damit die Konfiguration auch wirklich übernommen wird</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>docker compose rm -f</code></pre></div><p>Jetzt sind wir bereit die Instanz frisch zu starten</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label"/><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang=""><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><pre tabindex="0"><code>docker compose up -d</code></pre></div><p>Unter Einstellungen -&gt; Überblick sollten also keine weiteren Meldungen mehr auftauchen.</p><p>Nun sollte dein Nextcloud Docker Setup hervorragend laufen. Sollte dem nicht so sein, tritt doch meinem<a href="https://s.teqqy.de/discord" target="_blank" rel="noopener noreferrer">Discord Server<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
bei und lass dir von der Community helfen.</p>
]]></content:encoded><category>selfhosted</category><category>nextcloud</category><category>docker</category><category>traefik</category></item><item><title>Interne Namensauflösung bei Docker mit Traefik</title><link>https://www.teqqy.de/interne-namensaufloesung-bei-docker-mit-traefik/</link><pubDate>Thu, 12 Mar 2020 15:01:33 +0100</pubDate><lastBuildDate>Thu, 12 Mar 2020 15:01:33 +0100</lastBuildDate><guid isPermaLink="true">https://www.teqqy.de/interne-namensaufloesung-bei-docker-mit-traefik/</guid><description>Traefik nutze ich primär um als reverse proxy von extern auf meine Docker Container zugreifen zu können. Dies natürlich SSL terminiert. Verschiedene Dienste sollen allerdings nicht extern erreichbar sein und benötigen auch – aus meiner Sicht – nicht zwingend eine verschlüsstele Verbindung.
Aus diesem Grund habe ich auf meinem internen Docker Server Traefik als reverse proxy laufen, welcher den verschiedenen Diensten via netzwerkinterner DNS-Auflösung ein DNS Namen verpasst. So kann ich z. B. via http://phpipam.docker.domain.local (externer Link) auf mein PHPIPAM (externer Link) Dienst zugreifen.</description><content:encoded>&lt;![CDATA[<p><a href="/reverse-proxy-mit-traefik-unter-docker/">Traefik</a>
nutze ich primär um als reverse proxy von extern auf meine Docker Container zugreifen zu können. Dies natürlich<a href="/nginx-reverse-proxy-mit-lets-encrypt-und-cloudflare/">SSL</a>
terminiert. Verschiedene Dienste sollen allerdings nicht extern erreichbar sein und benötigen auch – aus meiner Sicht – nicht zwingend eine verschlüsstele Verbindung.</p><p>Aus diesem Grund habe ich auf meinem internen Docker Server<a href="/nginx-reverse-proxy-mit-lets-encrypt-und-cloudflare/">Traefik</a>
als reverse proxy laufen, welcher den verschiedenen Diensten via netzwerkinterner DNS-Auflösung ein DNS Namen verpasst. So kann ich z. B. via<a href="http://phpipam.docker.domain.local" target="_blank" rel="noopener noreferrer">http://phpipam.docker.domain.local<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
auf mein<a href="https://phpipam.net/" target="_blank" rel="noopener noreferrer">PHPIPAM<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
Dienst zugreifen.</p><h2 id="voraussetzungen">Voraussetzungen<a href="#voraussetzungen" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><ul><li>Docker Host</li><li>Bereits eingerichtet Services (ich empfehle die Services intern immer erst mal rudimentär zu testen und dann zu erweitern)</li><li>internen DNS Server (ich nutze hier Windows DNS)</li></ul><p>Auf meinem Windows DNS Server lege ich im DNS eine neue primäre Zone mit dem Namen „docker.domain.local“ (entsprechend an deine Bedürfnisse anpassen). Diese erhält dann einen einzigen A-Record der als Wildcard auf den Docker-Host zeigt.</p><h2 id="traefik-einrichten">Traefik einrichten<a href="#traefik-einrichten" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Um Traefik dann nutzen zu können, bediene ich mich zum Teil meiner vorhandenen<a href="https://github.com/cbirkenbeul/docker-homelab" target="_blank" rel="noopener noreferrer">Docker-Compose Sammlung<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
auf<a href="https://www.github.com/cbirkenbeul" target="_blank" rel="noopener noreferrer">Github<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
. Den Traefik Container und die traefik.toml Datei wird dabei ein wenig angepasst.</p><p>traefik.toml:</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">toml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="toml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-toml" data-lang="toml"><span style="display:flex;"><span>[log]</span></span><span style="display:flex;"><span>level =<span style="color:#a5d6ff">"DEBUG"</span></span></span><span style="display:flex;"><span/></span><span style="display:flex;"><span>[providers]</span></span><span style="display:flex;"><span>[providers.docker]</span></span><span style="display:flex;"><span>exposedByDefault =<span style="color:#79c0ff">false</span></span></span><span style="display:flex;"><span>endpoint =<span style="color:#a5d6ff">"unix:///var/run/docker.sock"</span></span></span><span style="display:flex;"><span>network =<span style="color:#a5d6ff">"traefik_proxy"</span></span></span><span style="display:flex;"><span/></span><span style="display:flex;"><span>[entryPoints]</span></span><span style="display:flex;"><span>[entryPoints.web]</span></span><span style="display:flex;"><span>address =<span style="color:#a5d6ff">":80"</span></span></span></code></pre></div></div><p>docker-compose.yaml</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">version</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">'3.3'</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">services</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">traefik</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">image</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik:latest</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">container_name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">restart</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">always</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">volumes</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">/var/run/docker.sock:/var/run/docker.sock</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">$PWD/config:/etc/traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">/etc/localtime:/etc/localtime</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">ports</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">"80:80"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">networks</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">default</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">traefik_proxy</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">networks</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">traefik_proxy</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">external</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">default</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">driver</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">bridge</span></span></span></code></pre></div></div><p>Anschließend lässt sich der Container starten und ist bereit um Container als reverse proxy anzubieten.</p><p>Bei den anzubietenden Services müssen wir dann natürlich auch noch die Compose Datei anpassen. Beispielhaft hier meine zu phpIPAM:</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">version</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">'3'</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">services</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">phpipam-mysql</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">image</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">mysql:5.7</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">container_name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">phpipam-mysql</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">restart</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">unless-stopped</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">volumes</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">$PWD/mysql:/var/lib/mysql</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">environment</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">MYSQL_ROOT_PASSWORD=ROOTPASSWORD</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">phpipam-phpipam</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">image</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">pierrecdn/phpipam:latest</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">container_name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">phpipam-phpipam</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">restart</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">unless-stopped</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">environment</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">MYSQL_ENV_MYSQL_USER=root</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">MYSQL_ENV_MYSQL_ROOT_PASSWORD=ROOTPASSWORD</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">MYSQL_ENV_MYSQL_HOST=phpipam-mysql</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">labels</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">"traefik.enable=true"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">"traefik.http.routers.phpipam-http.entrypoints=web"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">"traefik.http.routers.phpipam-http.rule=Host(`phpipam.docker.domain.local`)"</span><span style="color:#6e7681"/><span style="color:#8b949e;font-style:italic">#Domain anpassen</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">"traefik.http.services.phpipam.loadbalancer.server.port=80"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">depends_on</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">phpipam-mysql</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">networks</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">traefik_proxy</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">default</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">networks</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">traefik_proxy</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">external</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">default</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">driver</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">bridge</span></span></span></code></pre></div></div><p>Anschließend auch noch diese Compose Datei starten und nun lässt sich, wenn alles korrekt eingerichtet wurde, der Service als URL öffnen. So ist es wesentlich einfacherer als ich für jeden Service einen neuen Port überlegen zu müssen.</p>
]]></content:encoded><category>selfhosted</category><category>docker</category><category>traefik</category><category>dns</category></item><item><title>Docker-Compose Sammlung für dein Homelab</title><link>https://www.teqqy.de/docker-compose-sammlung-fuer-dein-homelab/</link><pubDate>Fri, 31 May 2019 14:19:21 +0200</pubDate><lastBuildDate>Fri, 31 May 2019 14:19:21 +0200</lastBuildDate><guid isPermaLink="true">https://www.teqqy.de/docker-compose-sammlung-fuer-dein-homelab/</guid><description>In meinen Videos verwende ich recht häufig Docker um Anwendungen zu installieren. Daher habe ich eine Docker-Compose Sammlung für Homelabs gestartet. Diese docker-compose.yaml Dateien sind von mir erstellt und/oder vorhandene editiert. Damit kannst du dein Docker Homelab schnell und einfach aufbauen.
Docker kommt beim heimischen Anwender immer mehr an. Zumindest wenn dieser technikinteressiert ist und sich auch die Arbeit damit machen möchte. Wer ein Docker Homelab starten möchte, kommt an Anfang nicht darum herum viel zu lesen. Allerdings möchte ich diesen Einstieg etwas einfacher gestalten.</description><content:encoded>&lt;![CDATA[<p>In meinen Videos verwende ich recht häufig Docker um Anwendungen zu installieren. Daher habe ich eine Docker-Compose Sammlung für Homelabs gestartet. Diese docker-compose.yaml Dateien sind von mir erstellt und/oder vorhandene editiert. Damit kannst du dein Docker Homelab schnell und einfach aufbauen.</p><p>Docker kommt beim heimischen Anwender immer mehr an. Zumindest wenn dieser technikinteressiert ist und sich auch die Arbeit damit machen möchte. Wer ein Docker Homelab starten möchte, kommt an Anfang nicht darum herum viel zu lesen. Allerdings möchte ich diesen Einstieg etwas einfacher gestalten.</p><p>Zwar gibt es immer noch das eine oder andere Problem mit dem reverse proxy (ich setze hierbei auf<a href="/nginx-reverse-proxy-mit-lets-encrypt-und-cloudflare/">Traefik</a>
), dennoch ist es mit ein paar Schritten schnell erledigt seine Lieblingsanwendung schnell und gut Verfügbar zu machen.</p><p>Auf der Plattform<a href="https://github.com" target="_blank" rel="noopener noreferrer">github.com<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
habe ich daher ein<a href="https://github.com/cbirkenbeul/docker-homelab" target="_blank" rel="noopener noreferrer">Repository<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
erstellt das ständig erweitert und aktualisiert wird. Gestartet habe ich jetzt erst mal mit Nextcloud und<a href="/reverse-proxy-mit-traefik-unter-docker/">Taefik</a>
. Hierzu wurde bereits ein Video veröffentlicht in dem ich das en detail zeige wie ihr das einrichten müsst.</p><p>Mit zukünftigen Videos wird auf dieses Repository immer hingewiesen und ich werde immer diese docker-compose.yaml Dateien verwenden. Wer mir also auf<a href="https://www.youtube.com/channel/UCnBQ7GosWO57aTpm2wR7Q7Q" target="_blank" rel="noopener noreferrer">YouTube<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
folgt (das solltest du, wenn du am Thema Homelab interessiert bist), wird die neusten Dateien immer mitbekommen.</p><p>Eines sei dazu aber noch gesagt: Diese Dateien sind sehr vereinfacht. Viele Dinge lassen sich anders und teils mit mehr Aufwand auch erledigen. Ich habe hier allerdings den kleinsten gemeinsamen Nenner gesucht und wohl auch gefunden. Solltet ihr Fehler entdecken, eröffnet ein<a href="https://github.com/cbirkenbeul/docker-homelab/issues" target="_blank" rel="noopener noreferrer">Issue<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
bei<a href="https://www.github.com/cbirkenbeul" target="_blank" rel="noopener noreferrer">Github<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
(wenn ihr einen Account habt) oder postet gerade in den entsprechenden Kommentaren.</p><p>Wenn dir eine bestimmte Software fehlen sollte, die du unbedingt dabei haben möchtest, bin ich natürlich gerne für Vorschläge offen. Natürlich kannst du auch ein Pull Request bei<a href="https://www.github.com/cbirkenbeul" target="_blank" rel="noopener noreferrer">GitHub<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
einreichen. Nach einer kurzen Überprüfung übernehme ich im Regelfall auch die Vorschläge der Community. So kann das Docker Homelab stetig bei allen wachsen.</p>
]]></content:encoded><category>selfhosted</category><category>docker</category><category>homelab</category><category>traefik</category></item><item><title>Reverse Proxy mit Traefik unter Docker</title><link>https://www.teqqy.de/reverse-proxy-mit-traefik-unter-docker/</link><pubDate>Sun, 07 Oct 2018 14:39:07 +0200</pubDate><lastBuildDate>Sun, 07 Oct 2018 14:39:07 +0200</lastBuildDate><guid isPermaLink="true">https://www.teqqy.de/reverse-proxy-mit-traefik-unter-docker/</guid><description>Um mehrere Webseiten unter einer IP und einer Domain zu veröffentlichen, ist es am einfachsten, wenn man sich ein sogenannten reverse proxy einrichtet. Die wohl bekannte Variante dazu ist von NGINX. Hierfür gibt es auch diverse Tutorials im Internet.
Meine ganzen Services, die ich extern verfügbar machen möchte, laufen allerdings als Docker (externer Link) Container. Entsprechend bietet es sich an, auch den reverse proxy Traefik unter Docker als Container laufen zu lassen.</description><content:encoded>&lt;![CDATA[<p>Um mehrere Webseiten unter einer IP und einer Domain zu veröffentlichen, ist es am einfachsten, wenn man sich ein sogenannten reverse proxy einrichtet. Die wohl bekannte Variante dazu ist von NGINX. Hierfür gibt es auch diverse Tutorials im Internet.</p><p>Meine ganzen Services, die ich extern verfügbar machen möchte, laufen allerdings als<a href="https://teqqy.de/tags/docker" target="_blank" rel="noopener noreferrer">Docker<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
Container. Entsprechend bietet es sich an, auch den reverse proxy Traefik unter Docker als Container laufen zu lassen.</p><p>Auch hier gibt es für NGINX – auch in Kombination mit Let’s encrypt Zertifikaten – reichlich Tutorials. Ich hatte mich damals allerdings für einen anderen Weg entscheiden und<a href="https://traefik.io/" target="_blank" rel="noopener noreferrer">Traefik<svg class="link-external-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg><span class="visually-hidden"> (externer Link)</span></a>
als reverse proxy genommen.</p><p>Wichtig ist natürlich, dass ihr in eurer Firewall bzw. Router ein NAT auf euren Docker Host einstellt. Port 80 (HTTP) und 443 (HTTPS) sollten entsprechend reichen.</p><h2 id="docker-container-mittels-compose">Docker Container mittels Compose<a href="#docker-container-mittels-compose" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Ich gehe erst mal davon aus, dass ihr Docker in einer der letzten Versionen installiert habt und eure Services, zumindest intern, vollständig funktionieren. Zudem nutze ich Docker Compose zum Verwalten meiner Container. Eine Adaption zu einem docker run command sollte kein Problem darstellen.</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">version</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">'3'</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">services</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">traefik</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">image</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik:latest</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">container_name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">restart</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">always</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">ports</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">80</span>:<span style="color:#a5d6ff">80</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">443</span>:<span style="color:#a5d6ff">443</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">8080</span>:<span style="color:#a5d6ff">8080</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">volumes</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">/var/run/docker.sock:/var/run/docker.sock</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">./traefik:/etc/traefik</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">environment</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">"TZ=Europe/Berlin"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">networks</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">traefik_proxy</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">default</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">networks</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">traefik_proxy</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">external</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">default</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">driver</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">bridge</span></span></span></code></pre></div></div><p>Ports 80 und 443 werden benötigt, um die entsprechenden Seiten dann auch weiterzuleiten. Port 8080 verwenden wir für das Webfrontend von Traefik. Ihr müsst also aufpassen, dass keine anderen Container diese Ports verwenden. Den Traefik Webport könnt ihr auch durch einen anderen ersetzen.</p><p>Zudem mounten wir als Volumes den Docker Socket, um Zugriff auf die laufenden Container zu haben. Als zweites Volume nutzen wir für die Konfigurationsdateien für Traefik.</p><p>Netzwerke legen wir an, um Traefik von außen erreichbar zu machen (default Netzwerk) und für das interne Routing zu Containern (traefik_proxy).</p><h2 id="traefik-konfiguration">Traefik Konfiguration<a href="#traefik-konfiguration" class="heading-anchor" aria-label="Diesen Abschnitt verlinken"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></a></h2><p>Im Verzeichnis traefik legen wir nun noch die Datei traefik.toml an, welche folgenden Inhalt bekommt:</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">toml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="toml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-toml" data-lang="toml"><span style="display:flex;"><span>logLevel =<span style="color:#a5d6ff">"INFO"</span></span></span><span style="display:flex;"><span>defaultEntryPoints = [<span style="color:#a5d6ff">"http"</span>,<span style="color:#a5d6ff">"https"</span>]</span></span><span style="display:flex;"><span/></span><span style="display:flex;"><span>[web]</span></span><span style="display:flex;"><span> address =<span style="color:#a5d6ff">":8080"</span></span></span><span style="display:flex;"><span/></span><span style="display:flex;"><span>[docker]</span></span><span style="display:flex;"><span> domain =<span style="color:#a5d6ff">"example.com"</span></span></span><span style="display:flex;"><span> watch =<span style="color:#79c0ff">true</span></span></span><span style="display:flex;"><span> exposedbydefault =<span style="color:#79c0ff">false</span></span></span><span style="display:flex;"><span/></span><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Force HTTPS</span></span></span><span style="display:flex;"><span>[entryPoints]</span></span><span style="display:flex;"><span> [entryPoints.http]</span></span><span style="display:flex;"><span> address =<span style="color:#a5d6ff">":80"</span></span></span><span style="display:flex;"><span> [entryPoints.http.redirect]</span></span><span style="display:flex;"><span> entryPoint =<span style="color:#a5d6ff">"https"</span></span></span><span style="display:flex;"><span> [entryPoints.https]</span></span><span style="display:flex;"><span> address =<span style="color:#a5d6ff">":443"</span></span></span><span style="display:flex;"><span> [entryPoints.https.tls]</span></span><span style="display:flex;"><span/></span><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Let's encrypt configuration</span></span></span><span style="display:flex;"><span>[acme]</span></span><span style="display:flex;"><span> email=<span style="color:#a5d6ff">"youremail.address@example.com"</span></span></span><span style="display:flex;"><span> storage=<span style="color:#a5d6ff">"/etc/traefik/acme/acme.json"</span></span></span><span style="display:flex;"><span> entryPoint=<span style="color:#a5d6ff">"https"</span></span></span><span style="display:flex;"><span> acmeLogging=<span style="color:#79c0ff">true</span></span></span><span style="display:flex;"><span> OnHostRule=<span style="color:#79c0ff">true</span></span></span><span style="display:flex;"><span> [acme.httpChallenge]</span></span><span style="display:flex;"><span> entryPoint =<span style="color:#a5d6ff">"http"</span></span></span></code></pre></div></div><p>Wichtig ist, dass ihr eure Domain unter [docker] und eure Email Adresse unter [acme] richtig anpasst. Die Email Adresse wird für die<a href="/nginx-reverse-proxy-mit-lets-encrypt-und-cloudflare/">Let’s encrypt</a>
Zertifikate benötigt.</p><p>Im Grundsätzlichen war es das schon für das Setup. Um jetzt Docker Container auch dazu zu bringen, auf die entsprechenden Domains zu hören, müssen wir die Konfiguration der einzelnen Container auch anpassen. Hier mal ein Beispiel von „The Lounge“ (einem IRC Frontend)</p><div class="code-block"><div class="code-block-header"><span class="code-lang-label">yaml</span><button class="code-copy-btn" type="button" aria-label="Code kopieren" data-umami-event="Code Copy" data-umami-event-lang="yaml"><svg class="icon-copy" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="icon-check" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg></button></div><div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#ff7b72">---</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">version</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">'3'</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">services</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">thelounge</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">image</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">thelounge/lounge:latest</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">container_name</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">thelounge</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">volumes</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">/var/docker/thelounge:/home/lounge/data</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">labels</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">"traefik.backend=thelounge"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">"traefik.enable=true"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">"traefik.frontend.rule=Host:subdomain.example.com"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">"traefik.port=9000"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">"traefik.docker.network=traefik_proxy"</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">networks</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/>-<span style="color:#a5d6ff">traefik_proxy</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#7ee787">networks</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">traefik_proxy</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">external</span>:<span style="color:#6e7681"/><span style="color:#79c0ff">true</span><span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">default</span>:<span style="color:#6e7681"/></span></span><span style="display:flex;"><span><span style="color:#6e7681"/><span style="color:#7ee787">driver</span>:<span style="color:#6e7681"/><span style="color:#a5d6ff">bridge</span></span></span></code></pre></div></div><p>Folgende Werte müsst ihr pro Container anpassen:</p><ul><li>traefik.backend (Name des Backends – könnt ihr frei vergeben)</li><li>traefik.frontend.rule (die URL, auf dem der Service hören soll)</li><li>traefik.port (der Port, auf dem eure Anwendung hört)</li></ul><p>Der Rest kann jeweils übernommen werden. Sollte ihr euren Container schon gestartet haben, solltet ihr diesen beenden, evtl. den Container löschen und neu starten. Ein paar Sekunden später ist der Service dann extern verfügbar.</p>
]]></content:encoded><category>selfhosted</category><category>traefik</category><category>docker</category><category>ssl-tls</category></item></channel></rss>