7.3. Setting up OpenShift Serverless transport encryption
Prerequisites
- You have access to an OpenShift Container Platform account with cluster administrator access.
- Install the {oc-first}.
- Install the cert-manager Operator for Red Hat OpenShift.
- Install the OpenShift Serverless Operator.
If you install the OpenShift Serverless Operator before installing the cert-manager Operator for Red Hat OpenShift, you must restart the controller and activator deployments in the knative-serving namespace. Failure to restart these deployments prevents Knative from creating the necessary cert-manager resources, which results in pending Knative Services and prevents enabling the Knative Serving cert-manager integration.
7.3.1. Configuring a SelfSigned cluster issuer 复制链接链接已复制到粘贴板!
The following procedure uses a SelfSigned issuer as the root certificate. For information about the implications and limitations of this method, see the SelfSigned cert-manager documentation.
If you manage your own company-specific Private Key Infrastructure (PKI), use the CA issuer. For more information, see cert-manager documentation on CA issuers.
Procedure
Create a
SelfSignedClusterIssuercustom resource (CR):Example ClusterIssuer CR
apiVersion: cert-manager.io/v1 kind: ClusterIssuer metadata: name: knative-serving-selfsigned-issuer spec: selfSigned: {}Apply the
ClusterIssuerCR by running the following command:$ oc apply -f <filename>Create a root certificate that refers to the
ClusterIssuerCR:Example root certificate
apiVersion: cert-manager.io/v1 kind: Certificate metadata: name: knative-serving-selfsigned-ca namespace: cert-manager1 spec: secretName: knative-serving-ca2 isCA: true commonName: selfsigned-ca privateKey: algorithm: ECDSA size: 256 issuerRef: name: knative-serving-selfsigned-issuer kind: ClusterIssuer group: cert-manager.ioApply the
CertificateCR by running the following command:$ oc apply -f <filename>
7.3.2. Creating a ClusterIssuer to be used by Serving 复制链接链接已复制到粘贴板!
To enable the use of certificates by Serving, you must create a cluster issuer.
Procedure
Create the
knative-serving-ca-issuerClusterIssuerfor Serving:apiVersion: cert-manager.io/v1 kind: ClusterIssuer metadata: name: knative-serving-ca-issuer spec: ca: secretName: knative-serving-ca1 - 1
- Secret name in the cert-manager Operator for Red Hat OpenShift namespace (
cert-managerby default) containing the certificate that can be used by OpenShift Serverless Serving components for new certificates.
Apply the
ClusterIssuerresource by running the following command:$ oc apply -f <filename>
7.3.3. Configuring transport encryption 复制链接链接已复制到粘贴板!
Configuring transport encryption consists of two parts:
Specifying the
ClusterIssuerissuer to use:-
clusterLocalIssuerRef: issuer for cluster-local-domain certificates used for ingress. -
systemInternalIssuerRef: issuer for certificates for system-internal-tls certificates used by Knative internal components.
-
Specifying transport encryption features to use:
-
cluster-local-domain-tls: Enables the transport encryption feature for cluster-local domains -
system-internal-tls: Enables the transport encryption feature for OpenShift Serverless Serving internal components.
-
Procedure
Enable transport encryption in the
KnativeServingresource:apiVersion: operator.knative.dev/v1beta1 kind: KnativeServing metadata: name: knative-serving namespace: knative-serving spec: ... config: certmanager: clusterLocalIssuerRef: | kind: ClusterIssuer name: knative-serving-ca-issuer1 systemInternalIssuerRef: | kind: ClusterIssuer name: knative-serving-ca-issuer2 network: cluster-local-domain-tls: Enabled3 system-internal-tls: Enabled4 Apply the
KnativeServingresource by running the following command:$ oc apply -f <filename>Optionally, change the
defaultCertificatevalue in the Ingress Controller:apiVersion: operator.openshift.io/v1 kind: IngressController ... spec: defaultCertificate: name: ca-ingress-certIf you changed the
defaultCertificatevalue, you must specify the custom certificate name in theopenshift-ingress-default-certificatefield in theKnativeServingcustom resource.For example, if the custom certificate name is
ca-ingress-cert, add the following configuration:... spec: config: network: system-internal-tls: Enabled openshift-ingress-default-certificate: "ca-ingress-cert" ...If you enabled
cluster-local-domain-tlsorsystem-internal-tls, restart the Controller component by running the following command.重要When either the
cluster-local-domain-tlsor thesystem-internal-tlsfeature is enabled, you must restart the Controller component to enable the Knative Servingcert-managerintegration.$ oc rollout restart deploy/controller -n knative-servingIf you enabled
system-internal-tls, restart the Activator component by running the following command.重要When the
system-internal-tlsfeature is activated, you must restart the Activator component to reconfigure its internal web server, as this is not possible during runtime.$ oc rollout restart deploy/activator -n knative-serving