Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
doc: add trust manager workarund for cert manager limitation
Sheen Capadngana86c5e1c9eef
diff --git a/docs/documentation/platform/pki/k8s-cert-manager.mdx b/docs/documentation/platform/pki/k8s-cert-manager.mdxindex 2479a72c9c..e552eae019 100644--- a/docs/documentation/platform/pki/k8s-cert-manager.mdx+++ b/docs/documentation/platform/pki/k8s-cert-manager.mdx@@ -246,6 +246,122 @@ The following steps show how to install cert-manager (using `kubectl`) and obtai</Steps>+## Injecting CA Certificate into Secrets with trust-manager++By default, cert-manager's ACME issuer does not populate the `ca.crt` field in the generated Kubernetes Secret ([see GitHub issue](https://github.com/cert-manager/cert-manager/issues/1571)). The secret will only contain `tls.crt` (the leaf certificate and chain) and `tls.key` (the private key).++If your application requires the CA certificate to be present in the secret (e.g., for mTLS or certificate verification), you can use [trust-manager](https://cert-manager.io/docs/trust/trust-manager/) to automatically inject the `ca.crt` field.++### Installing trust-manager++Install trust-manager with Secret targets enabled. This allows trust-manager to automatically inject the `ca.crt` field into secrets generated by cert-manager — whenever cert-manager creates or renews a certificate, trust-manager will ensure the CA certificate chain is included.++```bash+helm repo add jetstack https://charts.jetstack.io --force-update++helm upgrade trust-manager jetstack/trust-manager \+ --install \+ --namespace cert-manager \+ --wait \+ --set secretTargets.enabled=true \+ --set secretTargets.authorizedSecretsAll=true+```++<Note>+ The `secretTargets.authorizedSecretsAll=true` option grants trust-manager permission to write to all secrets in the cluster. For production environments, consider using `secretTargets.authorizedSecrets` to specify only the secrets that trust-manager should manage. Refer to the [trust-manager Helm chart documentation](https://cert-manager.io/docs/trust/trust-manager/installation/) for more details.+</Note>++### Creating the CA Certificate Secret++Create a Kubernetes Secret containing your CA certificate chain. To obtain the certificate chain from Infisical:++1. Navigate to your project in Infisical+2. Go to the **Certificate Authorities** tab+3. Select the CA that is issuing your certificates+4. Click the menu (three dots) next to the CA certificate and select **Download CA Certificate Chain**++This will download the full certificate chain from the selected CA up to the Root CA.++```yaml infisical-ca-cert.yaml+apiVersion: v1+kind: Secret+metadata:+ name: infisical-ca-cert+ namespace: cert-manager+type: Opaque+stringData:+ ca.crt: |+ -----BEGIN CERTIFICATE-----+ <paste_the_downloaded_certificate_chain_here>+ -----END CERTIFICATE-----+```++```bash+kubectl apply -f infisical-ca-cert.yaml+```++### Creating the trust-manager Bundle++Create a trust-manager `Bundle` resource that copies the CA certificate from the source secret into your certificate secrets.++```yaml trust-bundle.yaml+apiVersion: trust.cert-manager.io/v1alpha1+kind: Bundle+metadata:+ name: certificate-by-issuer+spec:+ sources:+ - secret:+ name: infisical-ca-cert+ key: ca.crt+ target:+ secret:+ key: ca.crt+ namespaceSelector:+ matchLabels:+ kubernetes.io/metadata.name: default+```++```bash+kubectl apply -f trust-bundle.yaml+```++<Note>+ - The `metadata.name` of the Bundle must match the `secretName` specified in your `Certificate` resource.+ - Update the `namespaceSelector` to match the namespace(s) where your certificate secrets are located.+ - The Bundle is cluster-scoped and can target secrets across multiple namespaces using `namespaceSelector`.+</Note>++### Verifying the CA Certificate Injection++After applying the Bundle, verify that the `ca.crt` field has been added to your certificate secret:++```bash+kubectl get secret certificate-by-issuer -o yaml+```++You should see output similar to:++```yaml+apiVersion: v1+data:+ ca.crt: <base64_encoded_ca_certificate>+ tls.crt: <base64_encoded_certificate_chain>+ tls.key: <base64_encoded_private_key>+kind: Secret+metadata:+ annotations:+ cert-manager.io/certificate-name: certificate-by-issuer+ cert-manager.io/issuer-name: issuer-infisical+ trust.cert-manager.io/hash: <hash_value>+ labels:+ controller.cert-manager.io/fao: "true"+ trust.cert-manager.io/bundle: certificate-by-issuer+ name: certificate-by-issuer+ namespace: default+type: Opaque+```+## FAQ<AccordionGroup>