Securing an exposed application with cert-manager

Install cert-manager, create a self-signed ClusterIssuer, and deploy WordPress with an annotation that makes cert-manager issue a TLS certificate for the ingress.

  • You have a project with a deployed Kubernetes cluster in the Ready status. You can create a new cluster or use an existing one.
  • You have a kubeconfig file for the cluster and a local terminal with kubectl. For more information, see Kubeconfig files in Overview.
  • The managed applications cert-manager and WordPress are available in a catalog that is bound to the project. For more information, see Binding projects to a catalog in Applications.
  1. Install cert-manager from the managed applications.

    In the catalog parameters, enable the crds.enabled parameter, so that the chart installs the cert-manager custom resource definitions (CRDs). For more information, see Installing an application on a project in Applications.

  2. Save the following self-signed ClusterIssuer in a file named selfsigned-issuer.yaml:
    apiVersion: cert-manager.io/v1
    kind: ClusterIssuer
    metadata:
      name: selfsigned-issuer
    spec:
      selfSigned: {}
  3. Apply the file:
    kubectl apply -f selfsigned-issuer.yaml
  4. Install WordPress from the managed applications, with the following settings:
    1. In the common settings, enable the Extra Values option.
    2. In the application parameters, enable ingress, set ingress.ingressClassName to ccf, and set the host name, as described in Exposing WordPress through the preconfigured ingress controller. When you enable ingress, the chart creates an ingress resource that exposes the application to the internet.
    3. In the extra values of the installation form, add the following annotation. The annotation instructs cert-manager to use the self-signed ClusterIssuer to issue the TLS certificate.
      ingress:
        annotations:
          cert-manager.io/cluster-issuer: "selfsigned-issuer"
  5. After the application is deployed, open the host name over HTTPS, for example https://<host-name>, and verify that the site loads.

cert-manager generates a self-signed TLS certificate for the domain, and the WordPress site loads over HTTPS. The browser marks the connection as not secure, because the certificate is self-signed.