Chapter 4. OpenShift Service Mesh and cert-manager
The cert-manager tool provides a unified API to manage X.509 certificates for applications in a Kubernetes environment. You can use cert-manager to integrate with public or private key infrastructures (PKI) and automate certificate renewal.
The cert-manager tool ensures the certificates are valid and up-to-date by attempting to renew certificates at a configured time before they expire.
4.1. About integrating Service Mesh with cert-manager and istio-csr Copy linkLink copied to clipboard!
The cert-manager Operator for Red Hat OpenShift enhances certificate management for securing workloads and control plane components in Red Hat OpenShift Service Mesh and Istio. It supports issuing, delivering, and renewing certificates used for mutual Transport Layer Security (mTLS) through cert-manager issuers.
- Verifying the identity of the workload.
- Creating a CSR through cert-manager for the workload.
The cert-manager tool then creates a CSR to the configured CA Issuer, which signs the certificate.
Red Hat provides support for integrating with istio-csr and cert-manager. Red Hat does not provide direct support for the istio-csr or the community cert-manager components. The use of community cert-manager shown here is for demonstration purposes only.
Prerequisites
One of these versions of cert-manager:
- Red Hat cert-manager Operator 1.10 or later
- community cert-manager Operator 1.11 or later
- cert-manager 1.11 or later
- Red Hat OpenShift Service Mesh 3.0 or later
-
An
IstioCNIinstance is running in the cluster -
Istio CLI (
istioctl) tool is installed -
jqis installed - Helm is installed
4.1.1. Installing cert-manager Copy linkLink copied to clipboard!
You can integrate the cert-manager Operator with OpenShift Service Mesh by deploying the istio-csr agent and configuring an Istio resource that uses the istio-csr agent to process workload and control plane certificate signing requests. The following procedure creates a self-signed issuer object.
You must install cert-manager before installing your Istio resource.
Procedure
Create the
istio-systemnamespace by running the following command:oc create namespace istio-system
$ oc create namespace istio-systemCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create the root issuer by creating an
Issuerobject in a YAML file.Create an
Issuerobject similar to the following example:Example
issuer.yamlfileCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create the objects by running the following command:
oc apply -f issuer.yaml
$ oc apply -f issuer.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Wait for the
istio-cacertificate to contain the "Ready" status condition by running the following command:oc wait --for=condition=Ready certificates/istio-ca -n istio-system
$ oc wait --for=condition=Ready certificates/istio-ca -n istio-systemCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Copy the
istio-cacertificate to thecert-managernamespace so it can be used by istio-csr:Copy the secret to a local file by running the following command:
oc get -n istio-system secret istio-ca -o jsonpath='{.data.tls\.crt}' | base64 -d > ca.pem$ oc get -n istio-system secret istio-ca -o jsonpath='{.data.tls\.crt}' | base64 -d > ca.pemCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a secret from the local certificate file in the
cert-managernamespace by running the following command:oc create secret generic -n cert-manager istio-root-ca --from-file=ca.pem=ca.pem
$ oc create secret generic -n cert-manager istio-root-ca --from-file=ca.pem=ca.pemCopy to Clipboard Copied! Toggle word wrap Toggle overflow