CA
The CA issuer represents a Certificate Authority whereby its certificate and
private key are stored inside the cluster as a Kubernetes Secret
, and will be
used to sign incoming certificate requests. This internal CA certificate can
then be used to trust resulting signed certificates.
This issuer type is typically used in a Public Key Infrastructure (PKI) setup to secure your infrastructure components to establish mTLS or otherwise provide a means to issue certificates where you also own the private key. Signed certificates will not be trusted by clients, such a web browser, by default.
Deployment
In order to create your CA issuer, you must first submit your CA certificate and
signing private key to the Kubernetes API server so that cert-manager is able to
retrieve them and sign certificates. This 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, however can be configured using the
--cluster-resource-namespace
flag on the cert-manager controller component.
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
should help
you here.
apiVersion: v1
kind: Secret
metadata:
name: ca-key-pair
namespace: sandbox
data:
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMrVENDQWVHZ0F3SUJBZ0lKQUtQR3dLRGwvNUhuTUEwR0NTcUdTSWIzRFFFQkN3VUFNQk14RVRBUEJnTlYKQkFNTUNHcHZjMmgyWVc1c01CNFhEVEU1TURneU1qRTJNRFUxT0ZvWERUSTVNRGd4T1RFMk1EVTFPRm93RXpFUgpNQThHQTFVRUF3d0lhbTl6YUhaaGJtd3dnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCRHdBd2dnRUtBb0lCCkFRQ3doU0IvcVc2L2tMYjJ6cHUrRUp2RDl3SEZhcStRQS8wSkgvTGxseW83ekFGeCtISHErQ09BYmsrQzhCNHQKL0hVRXNuczVSTDA5Q1orWDRqNnBiSkZkS2R1UHhYdTVaVllua3hZcFVEVTd5ZzdPU0tTWnpUbklaNzIzc01zMApSNmpZbi9Ecmo0eFhNSkVmSFVEcVllU1dsWnIzcWkxRU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S0tLS0tCg==
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/v1
kind: Issuer
metadata:
name: ca-issuer
namespace: sandbox
spec:
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-pair
crlDistributionPoints:
- "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.
configured for the CLI.
$ kubectl get issuers ca-issuer -n sandbox -o wide
NAME READY STATUS AGE
ca-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.