Questo contenuto non è disponibile nella lingua selezionata.
Chapter 11. Configuring TLS encryption in Eventing
With the transport encryption feature, you can transport data and events over secured and encrypted HTTPS connections by using Transport Layer Security (TLS).
The transport-encryption feature flag is an enum configuration that defines how Addressables, such as Broker, Channel, and Sink, accept events. It controls whether Addressables must accept events over HTTP or HTTPS based on the selected setting.
The possible values for transport-encryption are as follows:
| Value | Description |
|---|---|
|
|
|
|
|
|
|
|
|
11.1. Creating a SelfSigned ClusterIssuer resource for Eventing Copia collegamentoCollegamento copiato negli appunti!
ClusterIssuers are Kubernetes resources that represent certificate authorities (CAs) that can generate signed certificates by honoring certificate signing requests. All cert-manager certificates require a referenced issuer in a ready condition to attempt to honor the request. For more details, see Issuer.
For simplicity, this procedure uses a SelfSigned issuer as the root certificate authority. For more details about SelfSigned issuer implications and limitations, see SelfSigned issuers. If you are using a custom public key infrastructure (PKI), you must configure it so its privately signed CA certificates are recognized across the cluster. For more details about cert-manager, see certificate authorities (CAs). You can use any other issuer that is usable for cluster-local services.
Prerequisites
- You have cluster administrator permissions on OpenShift Container Platform, or you have cluster or dedicated administrator permissions on Red Hat OpenShift Service on AWS or OpenShift Dedicated.
- You have installed the OpenShift Serverless Operator.
- You have installed the cert-manager Operator for Red Hat OpenShift.
-
You have installed the OpenShift (
oc) CLI.
Procedure
Create a
SelfSignedClusterIssuerresource as follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the
ClusterIssuerresource by running the following command:oc apply -f <filename>
$ oc apply -f <filename>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a root certificate by using the
SelfSignedClusterIssuerresource as follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the
Certificateresource by running the following:oc apply -f <filename>
$ oc apply -f <filename>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
11.2. Creating a ClusterIssuer resource for Eventing Copia collegamentoCollegamento copiato negli appunti!
ClusterIssuers are Kubernetes resources that represent certificate authorities (CAs) that can generate signed certificates by honoring certificate signing requests.
Prerequisites
- You have cluster administrator permissions on OpenShift Container Platform, or you have cluster or dedicated administrator permissions on Red Hat OpenShift Service on AWS or OpenShift Dedicated.
- You have installed the OpenShift Serverless Operator.
- You have installed the cert-manager Operator for Red Hat OpenShift.
-
You have installed the OpenShift (
oc) CLI.
Procedure
Create the
knative-eventing-ca-issuerClusterIssuerresource as follows:Every Eventing component uses this issuer to issue their server’s certs.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The
secretNamevalue in thecert-managernamespace (default for cert-manager Operator for Red Hat OpenShift) contains the certificate that can be used by Knative Eventing components.
NoteThe
ClusterIssuername must beknative-eventing-ca-issuer.Apply the
ClusterIssuerresource by running the following command:oc apply -f <filename>
$ oc apply -f <filename>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
11.3. Enabling transport encrption for Knative Eventing Copia collegamentoCollegamento copiato negli appunti!
You can enable transport encryption in KnativeEventing by setting the transport-encryption feature to strict.
Prerequisites
- You have cluster administrator permissions on OpenShift Container Platform, or you have cluster or dedicated administrator permissions on Red Hat OpenShift Service on AWS or OpenShift Dedicated.
- You have installed the OpenShift Serverless Operator.
- You have installed the cert-manager Operator for Red Hat OpenShift.
-
You have installed the OpenShift (
oc) CLI.
Procedure
Enable the
transport-encryptioninKnativeEventingas follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the
KnativeEventingresource by running the following command:oc apply -f <filename>
$ oc apply -f <filename>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
11.4. Configuring additional CA trust bundles Copia collegamentoCollegamento copiato negli appunti!
By default, Eventing clients trust the OpenShift CA bundle configured for custom PKI. For more details, see Configuring a custom PKI.
When a new connection is established, Eventing clients automatically include these CA bundles in their trusted list.
Prerequisites
- You have cluster administrator permissions on OpenShift Container Platform, or you have cluster or dedicated administrator permissions on Red Hat OpenShift Service on AWS or OpenShift Dedicated.
- You have installed the OpenShift Serverless Operator.
- You have installed the cert-manager Operator for Red Hat OpenShift.
11.5. Configure custom event sources to trust the Eventing CA Copia collegamentoCollegamento copiato negli appunti!
To create a custom event source, use a SinkBinding. The SinkBinding can inject the configured CA trust bundles as a projected volume into each container by using the knative-custom-certs directory.
In specific cases, you might inject company-specific CA trust bundles into base container images and automatically configure runtimes, such as OpenJDK or Node.js, and so on. to trust those CA bundles. In such cases, you might not need to configure your clients.
By using the my_org_eventing_bundle config map from the previous example, with the ca.crt, ca1.crt, and tls.crt data keys, the knative-custom-certs directory has the following layout:
/knative-custom-certs/ca.crt /knative-custom-certs/ca1.crt /knative-custom-certs/tls.crt
/knative-custom-certs/ca.crt
/knative-custom-certs/ca1.crt
/knative-custom-certs/tls.crt
You can use these files to add CA trust bundles to HTTP clients that send events to Eventing.
Depending on the runtime, programming language, or library you use, different methods exist for configuring custom CA cert files, such as using command-line flags, environment variables, or reading the content of the files.
11.6. Adding a SelfSigned ClusterIssuer resource to CA trust bundles Copia collegamentoCollegamento copiato negli appunti!
If you are using a SelfSigned ClusterIssuer resource, you can add the CA to the Eventing CA trust bundles.
Prerequisites
- You have cluster administrator permissions on OpenShift Container Platform, or you have cluster or dedicated administrator permissions on Red Hat OpenShift Service on AWS or OpenShift Dedicated.
- You have installed the OpenShift Serverless Operator.
- You have installed the cert-manager Operator for Red Hat OpenShift.
-
You have installed the OpenShift (
oc) CLI.
Procedure
Export the CA from the
knative-eventing-casecret in the cert-manager Operator for Red Hat OpenShift namespace (default iscert-managercertificate) by running the following command:oc get secret -n cert-manager knative-eventing-ca -o=jsonpath='{.data.ca\.crt}' | base64 -d > ca.crt$ oc get secret -n cert-manager knative-eventing-ca -o=jsonpath='{.data.ca\.crt}' | base64 -d > ca.crtCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a CA trust bundle in the
knative-eventingnamespace by running the following command:oc create configmap -n knative-eventing my-org-selfsigned-ca-bundle --from-file=ca.crt
$ oc create configmap -n knative-eventing my-org-selfsigned-ca-bundle --from-file=ca.crtCopy to Clipboard Copied! Toggle word wrap Toggle overflow Label the
ConfigMapby running the following command:oc label configmap -n knative-eventing my-org-selfsigned-ca-bundle networking.knative.dev/trust-bundle=true
$ oc label configmap -n knative-eventing my-org-selfsigned-ca-bundle networking.knative.dev/trust-bundle=trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow
11.7. Ensuring seamless CA rotation Copia collegamentoCollegamento copiato negli appunti!
Ensuring seamless CA rotation is essential to avoid service downtime or to handle emergencies.
Prerequisites
- You have cluster administrator permissions on OpenShift Container Platform, or you have cluster or dedicated administrator permissions on Red Hat OpenShift Service on AWS or OpenShift Dedicated.
- You have installed the OpenShift Serverless Operator.
- You have installed the cert-manager Operator for Red Hat OpenShift.
-
You have installed the OpenShift (
oc) CLI.
Procedure
- Create a CA certificate.
Add the public key of the new CA certificate to the CA trust bundles.
Ensure that you also keep the public key of the existing CA.
Ensure all clients use the latest CA trust bundles.
Knative Eventing components automatically reload the updated CA trust bundles. For custom workloads that consume trust bundles, reload or restart them as needed.
-
Update the
knative-eventing-ca-issuerClusterIssuerto reference the secret containing the CA certificate that you created in step 1. Force
cert-managerto renew certificates in theknative-eventing namespace.For more information about
cert-manager, see Reissuance triggered by user actions.- As soon as the CA rotation is fully completed, remove the public key of the old CA from the trust bundle config map.
11.8. Verifying transport encryption in Eventing Copia collegamentoCollegamento copiato negli appunti!
To confirm that transport encryption is correctly configured, you can create and test an InMemoryChannel resource. Follow the steps to ensure that it uses HTTPS as expected.
Prerequisites
- You have cluster administrator permissions on OpenShift Container Platform, or you have cluster or dedicated administrator permissions on Red Hat OpenShift Service on AWS or OpenShift Dedicated.
- You have installed the OpenShift Serverless Operator.
- You have installed the cert-manager Operator for Red Hat OpenShift.
-
You have installed the OpenShift (
oc) CLI.
Procedure
Create an
InMemoryChannelresource as follows:apiVersion: messaging.knative.dev/v1 kind: InMemoryChannel metadata: name: transport-encryption-test
apiVersion: messaging.knative.dev/v1 kind: InMemoryChannel metadata: name: transport-encryption-testCopy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the
InMemoryChannelresource by running the following command:oc apply -f <filename>
$ oc apply -f <filename>Copy to Clipboard Copied! Toggle word wrap Toggle overflow View the
InMemoryChanneladdress by running the following command:oc get inmemorychannels.messaging.knative.dev transport-encryption-test
$ oc get inmemorychannels.messaging.knative.dev transport-encryption-testCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME URL AGE READY REASON transport-encryption-test https://imc-dispatcher.knative-eventing.svc.cluster.local/default/transport-encryption-test 17s True
NAME URL AGE READY REASON transport-encryption-test https://imc-dispatcher.knative-eventing.svc.cluster.local/default/transport-encryption-test 17s TrueCopy to Clipboard Copied! Toggle word wrap Toggle overflow