CA
⚠️ CA issuers are generally either for trying cert-manager out or else for advanced users with a good idea of how to run a PKI. To be used safely in production, CA issuers introduce complex planning requirements around rotation, trust store distribution and disaster recovery.
If you're not planning to run your own PKI, use a different issuer type.
The CA issuer represents a Certificate Authority whose certificate and
private key are stored inside the cluster as a Kubernetes Secret
.
Certificates issued by a CA issuer will not be publicly trusted and so are unlikely to be trusted by your applications without further configuration work. Consider the trust-manager project for distributing trust stores.
Deployment
CA Issuers must be configured with a certificate and private key stored in a Kubernetes
secret. You can create this externally if you wish, or you could bootstrap a root certificate
using a SelfSigned
issuer.
Your certificate's secret should reside in the same namespace as the Issuer
, or otherwise
in the Cluster Resource Namespace
in the case of a ClusterIssuer
.
The Cluster Resource Namespace
is defaulted as being the cert-manager
namespace, but
can be configured using the --cluster-resource-namespace
flag on the cert-manager controller.
Below is an example of a secret resource that will be used for signing. Take
note of the index keys used for each field as these are required in order for
cert-manager to find the certificate and key. Also note that, like all secrets,
data must be base64 encoded. The command $ cat crt.pem | base64 -w0
should help you
on GNU-based systems (Debian, Ubuntu, etc.) and $ cat crt.pem | base64 -b0
on BSD-based
systems (most notably macOS).
apiVersion: v1kind: Secretmetadata:name: ca-key-pairnamespace: sandboxdata:tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMrVENDQWVHZ0F3SUJBZ0lKQUtQR3dLRGwvNUhuTUEwR0NTcUdTSWIzRFFFQkN3VUFNQk14RVRBUEJnTlYKQkFNTUNHcHZjMmgyWVc1c01CNFhEVEU1TURneU1qRTJNRFUxT0ZvWERUSTVNRGd4T1RFMk1EVTFPRm93RXpFUgpNQThHQTFVRUF3d0lhbTl6YUhaaGJtd3dnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCRHdBd2dnRUtBb0lCCkFRQ3doU0IvcVc2L2tMYjJ6cHUrRUp2RDl3SEZhcStRQS8wSkgvTGxseW83ekFGeCtISHErQ09BYmsrQzhCNHQKL0hVRXNuczVSTDA5Q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MWM4RwpiUkJQOUNtWk9GL0hOcHN0MEgxenhNd1crUHk5Q2VnR3hhZ0ZCekxzVW84N0xWR2h0VFFZCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
Note: If your issuer represents an intermediate, ensure that
tls.crt
contains the issuer's full chain in the correct order:issuer -> intermediate(s) -> root
. The root (self-signed) CA certificate is optional, but adding it will ensure that the correct CA certificate is stored in the secrets for issuedCertificate
s under theca.crt
key. If you fail to provide a complete chain, it might not be possible for consumers of issuedCertificate
s to verify whether they're trusted.
Next is to deploy the CA issuer which references this Secret
. This is done by
referencing the secret name under the ca
stanza in the Issuer
spec.
apiVersion: cert-manager.io/v1kind: Issuermetadata:name: ca-issuernamespace: sandboxspec:ca:secretName: ca-key-pair
Optionally, you can specify CRL Distribution Points; an array of strings each of which identifies the location of the CRL from which the revocation of this certificate can be checked.
...spec:ca:secretName: ca-key-paircrlDistributionPoints:- "http://example.com"
Once deployed, you can then check that the issuer has been successfully
configured by checking the ready status of the certificate. Replace issuers
here with clusterissuers
if that is what has been deployed.
$ kubectl get issuers ca-issuer -n sandbox -o wideNAME READY STATUS AGEca-issuer True Signing CA verified 2m
Certificates are now ready to be requested by using the CA Issuer
named
ca-issuer
within the sandbox
namespace.