-
Notifications
You must be signed in to change notification settings - Fork 775
Provide a "default" Certificate for TLS #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I was searching a lot how I could swap Traefik auto generated certificates out and provide the default ones. Since there is a lot of confusion around this, I'll make an informational post here. Specifically I use Kubernetes and Ingresses with Cloudflare as DNS and Firewall provider. Cloudflare provides their own Edge certificates (for connection between CF and host server) that I need to upload and serve for all the hosts. I created secret of type tls. This is necessary. A) And tried using TLSStore (src: traefik/traefik#6057 (comment)) apiVersion: traefik.containo.us/v1alpha1
kind: TLSStore
metadata:
name: cloudflare-tls
namespace: traefik
spec:
defaultCertificate:
secretName: tls-secret but seems to be ignored by Kubernetes Ingress resources. This may work if you are using IngressRoute (Kubernetes CRD provided by Traefik) B) Then I went the dynamic config way: apiVersion: v1
kind: ConfigMap
metadata:
name: traefik-config
labels:
name: traefik-config
namespace: traefik
data:
dyn.yaml: |
# https://doc.traefik.io/traefik/https/tls/
tls:
stores:
default:
defaultCertificate:
certFile: '/certs/tls.crt'
keyFile: '/certs/tls.key' and used these values when deploying Traefik chart additionalArguments:
- '--providers.file.filename=/config/dyn.yaml'
volumes:
- name: tls-secret
mountPath: '/certs'
type: secret
- name: traefik-config
mountPath: '/config'
type: configMap and it works! It can be challenging to understand Traefik, especially when Kubernetes are involved, hope this will shed some light. Relevant: traefik/traefik#5468 (comment) |
I would like to see the ConfigMap and therefore my custom configuration to be managed within this HelmChart as well. additionalConfig: |
# https://doc.traefik.io/traefik/https/tls/
tls:
stores:
default:
defaultCertificate:
certFile: '/certs/tls.crt'
keyFile: '/certs/tls.key' and a ConfigMap like {{ if .Values.additionalConfig }}
apiVersion: v1
kind: ConfigMap
metadata:
name: traefik-config
labels:
name: traefik-config
data:
dyn.yaml: |
{{ .Values.additionalConfig }}
{{ end }} Maybe it could be possible to do that with the defaultCert as well, at least for the standard What do you think @SantoDE ? |
Please add the additional configuration section to the helm chart ! i have been spinning for days until i found this issue .. |
+1 wishing for an easier / more flexible way to configure this, as it feels like a very common use case when using wildcard certificates with LetsEncrypt: we want to be able to reuse this same certificate as the default at the cluster-level without needing to sync, copy, or reissue the TLS secret to each namespace where it is needed. @flexchar mentions a workaround, but I believe that this assumes that you are in the same namespace in which the secret was created by For example:
What happens:
Syncing/copying to every needed namespace adds complexity to automating the renewal of these certs, and it can be difficult to debug or even know if the sync/copy ever fails. Reissuing the same cert for every namespace can lead to being rate-limited by LetsEncrypt if your application scales out too far or too quickly. For our use case, we may need to switch back to NGINX, where this is a simple command-line flag that we can add to |
I'm going to quickly clarify that I have manually uploaded a certificate files (we are using Cloudflare ones) as a secret to Traefik namespace. Works great. Each of the actual applications incl. the Ingress manifest are in their own respective namespace zone - that works fine. |
I was able to achieve this by just creating a TLSStore apiVersion: traefik.containo.us/v1alpha1
kind: TLSStore
metadata:
name: default
spec:
defaultCertificate:
secretName: custom-default-cert Note that i did need to enable the feature for the IngressRoute custom resources, even though i am not using them. The default cert defined in the TLSStore works for Ingress objects. I also named the TLSStore "default". not sure if that is required, but the docs do mention that the only valid store is "default" |
@gmorse81 's solution works. |
This comment was marked as resolved.
This comment was marked as resolved.
@bodom0015 I have exactly the same issue. I've got
Therefore using the solution proposed by @gmorse81 with a |
@pfisterer, the answer provided by @gmorse81 does work, but you need to use a My setup:
First I create my
Then I create a
Once the certificate creation process has completed, Traefik will reload using the new default certificate. |
@kraihn Great, thank you! |
@kraihn, I'm trying to do the same thing, and I can't seem to get it to work. I have:
All with no success. Traefik debug level logging just keeps claiming there is "No certificate found for domain:..." Could you share your entrypoint and ingress tls configuration? |
Hello, Now that PR #601 has been merged, as @gmorse81 said, you can use the TLSStore to achieve this. |
For anyone reading this and trying to get @kraihn's solution to work, I had to add the apiVersion: traefik.containo.us/v1alpha1
kind: TLSStore
metadata:
name: default
namespace: `YOUR_TRAEFIK_NAMESPACE`
spec:
certificates:
- secretName: wildcard-example-com-tls
defaultCertificate:
secretName: wildcard-example-com-tls |
thanks, this did the trick ! |
If a user provides us his certificate data, we could create a
TLSStore
and attach the cert as a default certificate.Partially fixes #185
The text was updated successfully, but these errors were encountered: