Notes on how to set up a private CA using step-ca, integrate with cert-manager and use to automatically issue certificates for ingresses. We will use a JWK provisioner in a cluster-wide issuer to issue certificates.
Install step-ca
In this example, I install step-ca on a RaspberryPi and configure it as a systemd service.
Install step-ca from Debian packages:
Create a user for step-ca and set the home directory.
Set up the step user for convenience:
Go through the init process. In this case, since I already have a different service running on port 443, I chose to use port 8444.
The root and intermediate certificates will be created in /etc/step-ca/certs.
Add the new private CA certificate to the system trust store. Note this file will also be at /usr/local/share/ca-certificates/Smallstep_Root_CA_xx.crt.
To add a certificate into the system trust store on Debian, CA certificates can be added into /usr/local/share/ca-certificates/ in PEM format with the .crt extension. Then refresh the system trust store using sudo update-ca-certificates.
Set up the systemd service. Note you may need to create password.txt using the password from the prior step.
Enable the service and start it.
sudo systemctl daemon-reload
Check logs for errors
journalctl -u step-ca.service -f
Step Issuer and Cert Manager
These can be installed with their respective Helm charts.
Create new provisioner for step-issuer
On the step-ca host, set up new credentials for the new provisioner that the step issuer will use in the Kubernetes cluster.
Create the issuer
In this example, I want to issue certificates to Grafana. Note that there are three seperate namespaces to consider here:
Grafana
cert-manager
step-issuer
By the end of this configuration, generated certificates will be placed in a secret in the grafana namespace, using an issuer in the step-issuer namespace, with cert-manager parsing annotations on the ingress. Since we are dealing with cross-namespace resources, we will use a StepClusterIssuer rather than a StepIssuer.
Create the provisioner secret with the password from before: