You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* docs: fix user/tls-cert-manager Issuer/ClusterIssuer
Based on feedback from @irbekrm of cert-manager.
Signed-off-by: Tommie Gannert <[email protected]>
* docs: only use ClusterIssuer in docs/tls-cert-manager.
Incorporate additional feedback from @irbekrm.
Signed-off-by: Tommie Gannert <[email protected]>
@@ -51,33 +51,33 @@ cert-manager can have any number of *issuer* configurations.
51
51
The simplest issuer type is [SelfSigned](https://cert-manager.io/docs/configuration/selfsigned/).
52
52
It simply takes the certificate request and signs it with the private key it generates for the TLS Secret.
53
53
54
+
```{note}
55
+
Self-signed certificates don't provide any help in establishing trust between certificates.
56
+
However, they are great for initial testing, due to their simplicity.
57
+
```
58
+
54
59
To install self-signing, run
55
60
56
61
```console
57
62
$ kubectl apply -f - <<EOF
58
63
apiVersion: cert-manager.io/v1
59
-
kind: Issuer
64
+
kind: ClusterIssuer
60
65
metadata:
61
66
name: selfsigned
62
-
namespace: default
63
67
spec:
64
68
selfSigned: {}
65
69
EOF
66
70
```
67
71
68
-
The `selfSigned` issuer type is namespaced, which means it will use the Issuer resource kind.
69
-
It can only issue certificates for Secrets in the same namespace, here "default."
70
-
We will later see ClusterIssuer used, which can deal with Secrets (and hence Gateways) in any namespace.
71
-
72
72
## Creating a TLS Gateway Listener
73
73
74
-
We now have to create (or patch) a Gateway to reference cert-manager:
74
+
We now have to patch the example Gateway to reference cert-manager:
75
75
76
76
```console
77
77
$ kubectl patch gateway/eg --patch-file - <<EOF
78
78
metadata:
79
79
annotations:
80
-
cert-manager.io/issuer: selfsigned
80
+
cert-manager.io/clusterissuer: selfsigned
81
81
cert-manager.io/common-name: "Hello World!"
82
82
spec:
83
83
listeners:
@@ -99,7 +99,7 @@ cert-manager doesn't care, but we'll keep it all together in this guide.
99
99
Nowadays, X.509 certificates don't use the subject Common Name for hostname matching, so you can set it to whatever you want, or leave it empty.
100
100
The important parts here are
101
101
102
-
* the annotation referencing the "selfsigned" Issuer we created above,
102
+
* the annotation referencing the "selfsigned" ClusterIssuer we created above,
103
103
* the `hostname`, which is required (but see [#6051](https://github.com/cert-manager/cert-manager/issues/6051) for computing it based on attached HTTPRoutes), and
104
104
* the named Secret, which is what cert-manager will create for us.
105
105
@@ -143,8 +143,8 @@ If the `certificatRef` points to a valid certificate, given the hostnames found
143
143
144
144
If there is no valid certificate, or it is about to expire, cert-manager's `gateway-shim` creates a Certificate resource, or updates the existing one.
145
145
cert-manager then follows the [Certificate Lifecycle](https://cert-manager.io/docs/concepts/certificate/#certificate-lifecycle).
146
-
To know how to issue the certificate, an Issuer is configured, and referenced through annotations on the Gateway resource, which you did above.
147
-
Once a matching Issuer is found, that plugin does what needs to be done to acquire a signed certificate.
146
+
To know how to issue the certificate, an ClusterIssuer is configured, and referenced through annotations on the Gateway resource, which you did above.
147
+
Once a matching ClusterIssuer is found, that plugin does what needs to be done to acquire a signed certificate.
148
148
149
149
In the case of the ACME protocol (used by Let's Encrypt,) cert-manager can also use an HTTP Gateway to solve the HTTP-01 challenge type.
150
150
This is the other side of cert-manager's Gateway API support:
@@ -160,8 +160,6 @@ As you can imagine, cert-manager requires quite broad permissions to update Secr
160
160
We will start using the Let's Encrypt staging environment, to spare their production environment.
161
161
Our Gateway already contains an HTTP listener, so we will use that for the HTTP-01 challenges.
162
162
163
-
In the case of ACME, the plugin is a cluster-wide issuer type, so we have to use ClusterIssuer:
164
-
165
163
```console
166
164
$ CERT_MANAGER_CONTACT_EMAIL=$(git config user.email)# Or whatever...
167
165
$ kubectl apply -f - <<EOF
@@ -209,10 +207,9 @@ Status:
209
207
Now we're ready to update the Gateway annotation to use this issuer instead:
cert-manager [deletes unused Certificate resources](https://github.com/cert-manager/cert-manager/blob/c5e6bf39d688d202592318eaf91988466a7ee37b/pkg/controller/certificate-shim/sync.go#L171), and they are updated in-place when possible, so there should be no need for cleaning up Certificate resources:
294
-
If no Secret points to a Certificate, the Certificate is deleted.
290
+
You probably want to set the `cert-manager.io/revision-history-limit` annotation on your Gateway to make cert-manager prune the CertificateRequest history.
295
291
296
-
The other way around is also possible, using [a flag](https://cert-manager.io/docs/usage/certificate/#cleaning-up-secrets-when-certificates-are-deleted).
292
+
cert-manager [deletes unused Certificate resources](https://github.com/cert-manager/cert-manager/blob/c5e6bf39d688d202592318eaf91988466a7ee37b/pkg/controller/certificate-shim/sync.go#L171), and they are updated in-place when possible, so there should be no need for cleaning up Certificate resources.
293
+
The deletion is based on whether a Gateway still holds a `tls.certificateRefs` that requires the Certificate.
297
294
298
-
You probably want to set the `cert-manager.io/revision-history-limit` annotation on your Gateway to make cert-manager prune the CertificateRequest history.
295
+
If you remove a TLS listener from a Gateway, you may still have a Secret lingering.
296
+
cert-manager can clean it up using [a flag](https://cert-manager.io/docs/usage/certificate/#cleaning-up-secrets-when-certificates-are-deleted).
297
+
298
+
## Issuer Namespaces
299
+
300
+
We have used ClusterIssuer resources in this tutorial.
301
+
They are not bound to any namespace, and will read annotations from Gateways in any namespace.
302
+
You could also use [Issuer](https://cert-manager.io/docs/concepts/issuer/), which is bound to a namespace.
303
+
This is useful e.g. if you want to use different ACME accounts for different namespaces.
304
+
305
+
If you change the issuer kind, you also need to change the annotation key from `cert-manager.io/clusterissuer` to `cert-manager.io/issuer`.
0 commit comments