Concept
This guide demonstrates how to use Infisical to issue TLS certificates back to your Kubernetes environment using cert-manager. It uses the ACME issuer type to request and renew certificates automatically from Infisical using the ACME enrollment method configured on a certificate profile. The issuer is perfect at obtaining X.509 certificates for Ingresses and other Kubernetes resources and can automatically renew them before expiration. The typical workflow involves installingcert-manager and configuring resources that represent the connection details to Infisical as well as the certificates you want to issue.
Each issued certificate and its corresponding private key are stored in a Kubernetes Secret.
We recommend reading the official cert-manager documentation for a complete overview.
For the ACME-specific configuration, refer to the ACME section.
Workflow
A typical workflow for using cert-manager with Infisical via ACME consists of the following steps:- Create a certificate profile in Infisical with the ACME enrollment method configured on it.
- Install
cert-managerin your Kubernetes cluster. - Create a Kubernetes
Secretcontaining the EAB (External Account Binding) credentials for the ACME certificate profile. - Create an
IssuerorClusterIssuerresource that connects to the desired Infisical certificate profile. - Create a
Certificateresource defining the certificate you wish to issue and the targetSecretwhere the certificate and private key will be stored. - Use the resulting Kubernetes
Secretin your Ingresses or other resources.
Guide
The following steps show how to install cert-manager (usingkubectl) and obtain certificates from Infisical.
1
Create a certificate profile with ACME as the enrollment method in Infisical
Follow the instructions here to create a certificate profile that uses ACME enrollment.After completion, you will have the following values:
- ACME Directory URL
- EAB Key ID (KID)
- EAB Secret
Currently, the Infisical ACME enrollment method only supports authentication via dedicated EAB credentials generated per certificate profile.Support for Kubernetes Auth is planned for the near future.
2
Install cert-manager
Install cert-manager in your Kubernetes cluster by following the official guide here or by applying the manifest directly:
3
Create a Kubernetes Secret for the Infisical ACME EAB credentials
Create a Kubernetes
Secret that contains the EAB Secret (HMAC key) obtained in step 1.
The cert-manager uses this secret to authenticate with the Infisical ACME server.- kubectl command
- Configuration file
4
Create the cert-manager Issuer connecting to Infisical ACME server
Next, create a cert-manager You can check that the issuer was created successfully by running the following command:
Issuer (or ClusterIssuer) by replacing the placeholders <acme_server_url>, <your_email>, and <acme_eab_kid> in the configuration below and applying it.
This resource configures cert-manager to use your Infisical PKI collection’s ACME server for certificate issuance.issuer-infisical.yaml
- Currently, the Infisical ACME server only supports the HTTP-01 challenge and requires successful challenge completion before issuing certificates. Support for optional challenges and DNS-01 is planned for a future release.
- An
Issueris namespace-scoped. Certificates can only be issued using anIssuerthat exists in the same namespace as theCertificateresource. - If you need to issue certificates across multiple namespaces with a single resource, create a
ClusterIssuerinstead. The configuration is identical exceptkind: ClusterIssuerand nometadata.namespace. - More details: https://cert-manager.io/docs/configuration/acme/
5
Create the Certificate
Finally, request a certificate from Infisical ACME server by creating a cert-manager The above sample configuration file specifies a certificate to be issued with the dns name
Certificate resource.
This configuration file specifies the details of the (end-entity/leaf) certificate to be issued.certificate-issuer.yaml
certificate-by-issuer.example.com and ECDSA private key using the P-256 curve, valid for 48 hours; the certificate will be automatically renewed by cert-manager 12 hours before expiry.
The certificate is issued by the issuer issuer-infisical created in the previous step and the resulting certificate and private key will be stored in a secret named certificate-by-issuer.Note that the full list of the fields supported on the Certificate resource can be found in the API reference documentation here.You can check that the certificate was created successfully by running the following command:6
Use Certificate in Kubernetes Secret
Since the actual certificate and private key are stored in a Kubernetes secret, we can check that the secret was created successfully by running the following command:We can Here, In any case, the certificate is ready to be used as Kubernetes Secret by your Kubernetes resources.
describe the secret to get more information about it:ca.crt is the Root CA certificate, tls.crt is the requested certificate followed by the certificate chain, and tls.key is the private key for the certificate.We can decode the certificate and print it out using openssl:FAQ
What fields can be configured on the Certificate resource?
What fields can be configured on the Certificate resource?
The full list of the fields supported on the
Certificate resource can be found in the API reference documentation here.Currently, not all fields are supported by the Infisical PKI ACME server.
Can certificates be renewed automatically?
Can certificates be renewed automatically?
Yes.
cert-manager will automatically renew certificates according to the renewBefore threshold of expiry as
specified in the corresponding Certificate resource.You can read more about the renewBefore field here.