Creating certificates for user workloads

To secure communications for your applications, create and manage TLS certificates for your workloads by using the cert-manager Operator for Red Hat OpenShift

Prerequisites
  • You have access to the cluster with cluster-admin privileges.

  • You have installed the cert-manager Operator for Red Hat OpenShift.

Procedure
  1. Create an issuer. For more information, see "Configuring an issuer" in the "Additional resources" section.

  2. Create a certificate:

    1. Create a YAML file, for example, certificate.yaml, that defines the Certificate object:

      apiVersion: cert-manager.io/v1
      kind: Certificate
      metadata:
        name: <tls_cert>
        namespace: <issuer_namespace>
      spec:
        isCA: false
        commonName: '<common_name>'
        secretName: <secret_name>
        dnsNames:
        - "<domain_name>"
        issuerRef:
          name: <issuer_name>
          kind: Issuer

      where:

      <tls_cert>

      Specifies a name for the certificate.

      <issuer_namespace>

      Specifies the namespace of the issuer.

      <common_name>

      Specifies the common name (CN).

      <secret_name>

      Specifies the name of the secret to create that contains the certificate.

      <domain_name>

      Specifies the domain name.

      <issuer_name>

      Specifies the name of the issuer.

    2. Create the Certificate object by running the following command:

      $ oc create -f certificate.yaml
Verification
  • Verify that the certificate is created and ready to use by running the following command:

    $ oc get certificate -w -n <issuer_namespace>

    Once certificate is in Ready status, workloads on your cluster can start using the generated certificate secret.