{"id":274,"date":"2023-07-19T05:55:12","date_gmt":"2023-07-19T05:55:12","guid":{"rendered":"http:\/\/www.adartis.de\/?p=274"},"modified":"2023-07-19T07:19:05","modified_gmt":"2023-07-19T07:19:05","slug":"traefik-freischaltung-tls-mit-einer-beispielanwendung-harbor","status":"publish","type":"post","link":"https:\/\/www.adartis.de\/?p=274","title":{"rendered":"Traefik"},"content":{"rendered":"\n<p class=\"has-text-align-center has-foreground-color has-text-color has-medium-font-size\"><strong>Traefik: Freischaltung TLS mit einer Beispielanwendung (Harbor)<\/strong><\/p>\n\n\n\n<p>Um dieses Ziel zu erreichen, muss man sich um ein paar Sachen k\u00fcmmern.<\/p>\n\n\n\n<p>1- Wenn self-signed certificate benutzt wird, muss folgende argument zu Traefik config hizugef\u00fcgt werden.<\/p>\n\n\n\n<p>&#8211;serversTransport.insecureSkipVerify=true<\/p>\n\n\n\n<p>2-Traefik Middleware muss wegen http-redirect erstellt werden.<\/p>\n\n\n\n<p class=\"has-background\" style=\"background-color:#e4e6e9\">apiVersion: traefik.containo.us\/v1alpha1<br>kind: Middleware<br>metadata:<br>name: httpredirect<br>namespace: harbor<br>spec:<br>redirectScheme:<br>scheme: https<br>permanent: true<\/p>\n\n\n\n<p>3-TLS Zertifikat muss als ein kubernetes secret definiert werden. Die Private-key muss \u201cunencrypted\u201c sein.<\/p>\n\n\n\n<p>$ kubectl create secret tls adartis-cert &#8211;key=key.unencrypted.pem &#8211;cert=server.pem -n harbor<\/p>\n\n\n\n<p>4-Die komplette Code durch einem K8s IngressRoute is wie folgt:<\/p>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\" style=\"line-height:0.5\">\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\">\n<p>apiVersion: traefik.containo.us\/v1alpha1<\/p>\n<\/div>\n\n\n\n<p>kind: Middleware<\/p>\n\n\n\n<p>metadata:<\/p>\n<\/div>\n\n\n\n<p>&nbsp; name: httpredirect<\/p>\n\n\n\n<p>&nbsp; namespace: harbor<\/p>\n\n\n\n<p>spec:<\/p>\n\n\n\n<p>&nbsp; redirectScheme:<\/p>\n\n\n\n<p>&nbsp; &nbsp; scheme: https<\/p>\n\n\n\n<p>&nbsp; &nbsp; permanent: true<\/p>\n<\/div>\n\n\n\n<p>&#8212;<\/p>\n\n\n\n<p style=\"line-height:0.5\">apiVersion: traefik.containo.us\/v1alpha1<\/p>\n\n\n\n<p style=\"line-height:0.5\">kind: IngressRoute<\/p>\n\n\n\n<p style=\"line-height:0.5\">metadata:<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; name: harbor-ing<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; namespace: harbor<\/p>\n\n\n\n<p style=\"line-height:0.5\">spec:<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; entryPoints:<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; &nbsp; &#8211; web<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; &nbsp; &#8211; websecure<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; routes:<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; &nbsp; &#8211; kind: Rule<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; &nbsp; &nbsp; match: Host(`harbor.apps.rancher.adartish.de`)<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; &nbsp; &nbsp; middlewares:<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; &nbsp; &nbsp; &nbsp; &#8211; name: httpredirect<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; &nbsp; &nbsp; services:<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; &nbsp; &nbsp; &nbsp; &#8211; kind: Service<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name: harbor-11-1636456482<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; passHostHeader: true<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; namespace: harbor<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; port: 443<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; tls: &nbsp;<\/p>\n\n\n\n<p style=\"line-height:0.5\">&nbsp; &nbsp; secretName: adartis-cert &nbsp; &nbsp;<\/p>\n\n\n\n<p>5-Change an encrypted private-key.pem to UNencrypted:<\/p>\n\n\n\n<p><code>openssl rsa -in key.pem -out key.unencrypted.pem -passin pass:TYPE_YOUR_PASS<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Traefik: Freischaltung TLS mit einer Beispielanwendung (Harbor) Um dieses Ziel zu erreichen, muss man sich [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-274","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.adartis.de\/index.php?rest_route=\/wp\/v2\/posts\/274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.adartis.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.adartis.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.adartis.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.adartis.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=274"}],"version-history":[{"count":7,"href":"https:\/\/www.adartis.de\/index.php?rest_route=\/wp\/v2\/posts\/274\/revisions"}],"predecessor-version":[{"id":308,"href":"https:\/\/www.adartis.de\/index.php?rest_route=\/wp\/v2\/posts\/274\/revisions\/308"}],"wp:attachment":[{"href":"https:\/\/www.adartis.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.adartis.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.adartis.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}