Chapter 5. 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.
5.1. About the cert-manager Operator istio-csr agent 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.
By integrating Istio with the
istio-csr
The cert-manager Operator for Red Hat OpenShift must be installed before you create and install your
Istio
5.1.1. Integrating Service Mesh with the cert-manager Operator by using the istio-csr agent Copy linkLink copied to clipboard!
You can integrate the cert-manager Operator with OpenShift Service Mesh by deploying the
istio-csr
Istio
istio-csr
issuer
Prerequisites
- You have installed the cert-manager Operator for Red Hat OpenShift version 1.15.1.
- You are logged in to OpenShift Container Platform 4.14 or later.
- You have installed the OpenShift Service Mesh Operator.
-
You have a instance running in the cluster.
IstioCNI -
You have installed the command.
istioctl
Procedure
Create the
namespace by running the following command:istio-system$ oc create namespace istio-systemPatch the cert-manager Operator to install the
agent by running the following command:istio-csr$ oc -n cert-manager-operator patch subscription openshift-cert-manager-operator \ --type='merge' -p \ '{"spec":{"config":{"env":[{"name":"UNSUPPORTED_ADDON_FEATURES","value":"IstioCSR=true"}]}}}'Create the root certificate authority (CA) issuer by creating an
object for theIssueragent:istio-csrCreate a new project for installing the
agent by running the following command:istio-csr$ oc new-project istio-csrCreate an
object similar to the following example:IssuerNoteThe
issuer is intended for demonstration, testing, or proof-of-concept environments. For production deployments, use a secure and trusted CA.selfSignedExample
issuer.yamlfileapiVersion: cert-manager.io/v1 kind: Issuer metadata: name: selfsigned namespace: istio-system spec: selfSigned: {} --- apiVersion: cert-manager.io/v1 kind: Certificate metadata: name: istio-ca namespace: istio-system spec: isCA: true duration: 87600h secretName: istio-ca commonName: istio-ca privateKey: algorithm: ECDSA size: 256 subject: organizations: - cluster.local - cert-manager issuerRef: name: selfsigned kind: Issuer group: cert-manager.io --- apiVersion: cert-manager.io/v1 kind: Issuer metadata: name: istio-ca namespace: istio-system spec: ca: secretName: istio-caCreate the objects by running the following command:
$ oc apply -f issuer.yamlWait for the
certificate to contain the "Ready" status condition by running the following command:istio-ca$ oc wait --for=condition=Ready certificates/istio-ca -n istio-system
Create the
custom resource:IstioCSRCreate the
custom resource similar to the following example:IstioCSRExample
istioCSR.yamlfileapiVersion: operator.openshift.io/v1alpha1 kind: IstioCSR metadata: name: default namespace: istio-csr spec: istioCSRConfig: certManager: issuerRef: name: istio-ca kind: Issuer group: cert-manager.io istiodTLSConfig: trustDomain: cluster.local istio: namespace: istio-systemCreate the
agent by by running the following command:istio-csr$ oc create -f istioCSR.yamlVerify that the
deployment is ready by running the following command:istio-csr$ oc get deployment -n istio-csr
Install the
resource:istioNoteThe configuration disables the built-in CA server for Istio and forwards certificate signing requests from
to theistiodagent. Theistio-csragent obtains certificates for bothistio-csrand mesh workloads from the cert-manager Operator. TheistiodTLS certificate that is generated by theistiodagent is mounted into the pod at a known location for use.istio-csrCreate the
object similar to the following example:IstioExample
istio.yamlfileapiVersion: sailoperator.io/v1 kind: Istio metadata: name: default spec: version: v1.24-latest namespace: istio-system values: global: caAddress: cert-manager-istio-csr.istio-csr.svc:443 pilot: env: ENABLE_CA_SERVER: "false"Create the
resource by running the following command:Istio$ oc apply -f istio.yamlVerify that the
resource displays the "Ready" status condition by running the following command:istio$ oc wait --for=condition=Ready istios/default -n istio-system
5.1.2. Verifying Service Mesh with the cert-manager Operator using the istio-csr agent Copy linkLink copied to clipboard!
You can use the sample
httpbin
sleep
Create the namespaces:
Create the
namespace by running the following command:apps-1$ oc new-project apps-1Create the
namespace by running the following command:apps-2$ oc new-project apps-2
Add the
label on the namespaces:istio-injection=enabledAdd the
label on theistio-injection=enablednamespace by running the following command:apps-1$ oc label namespaces apps-1 istio-injection=enabledAdd the
label on theistio-injection=enablednamespace by running the following command:apps-2$ oc label namespaces apps-2 istio-injection=enabled
Deploy the
app in the namespaces:httpbinDeploy the
app in thehttpbinnamespace by running the following command:apps-1$ oc apply -n apps-1 -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/httpbin/httpbin.yamlDeploy the
app in thehttpbinnamespace by running the following command:apps-2$ oc apply -n apps-2 -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/httpbin/httpbin.yaml
Deploy the
app in the namespaces:sleepDeploy the
app in thesleepnamespace by running the following command:apps-1$ oc apply -n apps-1 -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/sleep/sleep.yamlDeploy the
app in thesleepnamespace by running the following command:apps-2$ oc apply -n apps-2 -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/sleep/sleep.yaml
Verify that the created apps have sidecars injected:
Verify that the created apps have sidecars injected for
namespace by running the following command:apps-1$ oc get pods -n apps-1Verify that the created apps have sidecars injected for
namespace by running the following command:apps-2$ oc get pods -n apps-2
Create a mesh-wide strict mutual Transport Layer Security (mTLS) policy similar to the following example:
NoteEnabling
in strict mTLS mode verifies that certificates are distributed correctly and that mTLS communication functions between workloads.PeerAuthenticationExample
peer_auth.yamlfileapiVersion: security.istio.io/v1beta1 kind: PeerAuthentication metadata: name: default namespace: istio-system spec: mtls: mode: STRICTApply the mTLS policy by running the following command:
$ oc apply -f peer_auth.yamlVerify that the
app can access theapps-1/sleepservice by running the following command:apps-2/httpbin$ oc -n apps-1 exec "$(oc -n apps-1 get pod \ -l app=sleep -o jsonpath={.items..metadata.name})" \ -c sleep -- curl -sIL http://httpbin.apps-2.svc.cluster.local:8000Example output
HTTP/1.1 200 OK access-control-allow-credentials: true access-control-allow-origin: * content-security-policy: default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' camo.githubusercontent.com content-type: text/html; charset=utf-8 date: Wed, 18 Jun 2025 09:20:55 GMT x-envoy-upstream-service-time: 14 server: envoy transfer-encoding: chunkedVerify that the
app can access theapps-2/sleepservice by running the following command:apps-1/httpbin$ oc -n apps-2 exec "$(oc -n apps-1 get pod \ -l app=sleep -o jsonpath={.items..metadata.name})" \ -c sleep -- curl -sIL http://httpbin.apps-2.svc.cluster.local:8000Example output
HTTP/1.1 200 OK access-control-allow-credentials: true access-control-allow-origin: * content-security-policy: default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' camo.githubusercontent.com content-type: text/html; charset=utf-8 date: Wed, 18 Jun 2025 09:21:23 GMT x-envoy-upstream-service-time: 16 server: envoy transfer-encoding: chunkedVerify that the
workload certificate matches as expected by running the following command:httpbin$ istioctl proxy-config secret -n apps-1 \ $(oc get pods -n apps-1 -o jsonpath='{.items..metadata.name}' --selector app=httpbin) \ -o json | jq -r '.dynamicActiveSecrets[0].secret.tlsCertificate.certificateChain.inlineBytes' \ | base64 --decode | openssl x509 -text -nooutExample output
... Issuer: O = cert-manager + O = cluster.local, CN = istio-ca ... X509v3 Subject Alternative Name: URI:spiffe://cluster.local/ns/apps-1/sa/httpbin
5.1.3. Uninstalling Service Mesh with the cert-manager Operator by using the istio-csr agent Copy linkLink copied to clipboard!
You can uninstall the cert-manager Operator with OpenShift Service Mesh by completing the following procedure. Before you remove the following resources, verify that no Red Hat OpenShift Service Mesh or Istio components reference the
Istio-CSR
Procedure
Remove the
custom resource by running the following command:IstioCSR$ oc -n <istio-csr_project_name> delete istiocsrs.operator.openshift.io defaultRemove the related resources:
List the cluster scoped-resources by running the following command:
$ oc get clusterrolebindings,clusterroles -l "app=cert-manager-istio-csr,app.kubernetes.io/name=cert-manager-istio-csr"Save the names of the listed resources for later reference.
List the resources in
agent deployed namespace by running the following command:istio-csr$ oc get certificate,deployments,services,serviceaccounts -l "app=cert-manager-istio-csr,app.kubernetes.io/name=cert-manager-istio-csr" -n <istio_csr_project_name>Save the names of the listed resources for later reference.
List the resources in Red Hat OpenShift Service Mesh or Istio deployed namespaces by running the following command:
$ oc get roles,rolebindings \ -l "app=cert-manager-istio-csr,app.kubernetes.io/name=cert-manager-istio-csr" \ -n <istio_csr_project_name>Save the names of the listed resources for later reference.
For each resource listed in previous steps, delete the resources by running the following command:
$ oc -n <istio_csr_project_name> delete <resource_type>/<resource_name>