Channels are custom resources that define a single event-forwarding and persistence layer. After events have been sent to a channel from an event source or producer, these events can be sent to multiple Knative services or other sinks by using a subscription.
You can create channels by instantiating a supported Channel
object, and configure re-delivery attempts by modifying the delivery
spec in a Subscription
object.
After Knative Eventing is installed on your cluster, you can create a channel by using the Administrator perspective.
The OpenShift Serverless Operator and Knative Eventing are installed on your OpenShift Container Platform cluster.
You have logged in to the web console and are in the Administrator perspective.
You have cluster administrator permissions for OpenShift Container Platform.
In the Administrator perspective of the OpenShift Container Platform web console, navigate to Serverless → Eventing.
In the Create list, select Channel. You will be directed to the Channel page.
Select the type of Channel
object that you want to create in the Type list.
Currently only |
click Create.
Using the OpenShift Container Platform web console provides a streamlined and intuitive user interface to create a channel. After Knative Eventing is installed on your cluster, you can create a channel by using the web console.
You have logged in to the OpenShift Container Platform web console.
The OpenShift Serverless Operator and Knative Eventing are installed on your OpenShift Container Platform cluster.
You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in OpenShift Container Platform.
In the Developer perspective, navigate to +Add → Channel.
Select the type of Channel
object that you want to create in the Type list.
click Create.
Confirm that the channel now exists by navigating to the Topology page.
Using the Knative (kn
) cli to create channels provides a more streamlined and intuitive user interface than modifying YAML files directly. You can use the kn channel create
command to create a channel.
The OpenShift Serverless Operator and Knative Eventing are installed on the cluster.
You have installed the Knative (kn
) cli.
You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in OpenShift Container Platform.
Create a channel:
$ kn channel create <channel_name> --type <channel_type>
The channel type is optional, but where specified, must be given in the format Group:Version:Kind
.
For example, you can create an InMemoryChannel
object:
$ kn channel create mychannel --type messaging.knative.dev:v1:InMemoryChannel
Channel 'mychannel' created in namespace 'default'.
To confirm that the channel now exists, list the existing channels and inspect the output:
$ kn channel list
kn channel list
NAME TYPE URL AGE READY REASON
mychannel InMemoryChannel http://mychannel-kn-channel.default.svc.cluster.local 93s True
Delete a channel:
$ kn channel delete <channel_name>
Creating Knative resources by using YAML files uses a declarative API, which enables you to describe channels declaratively and in a reproducible manner. To create a serverless channel by using YAML, you must create a YAML file that defines a Channel
object, then apply it by using the oc apply
command.
The OpenShift Serverless Operator and Knative Eventing are installed on the cluster.
Install the OpenShift cli (oc
).
You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in OpenShift Container Platform.
Create a Channel
object as a YAML file:
apiVersion: messaging.knative.dev/v1
kind: Channel
metadata:
name: example-channel
namespace: default
Apply the YAML file:
$ oc apply -f <filename>
Creating Knative resources by using YAML files uses a declarative API, which enables you to describe channels declaratively and in a reproducible manner. You can create a Knative Eventing channel that is backed by Kafka topics by creating a Kafka channel. To create a Kafka channel by using YAML, you must create a YAML file that defines a KafkaChannel
object, then apply it by using the oc apply
command.
The OpenShift Serverless Operator, Knative Eventing, and the KnativeKafka
custom resource are installed on your OpenShift Container Platform cluster.
Install the OpenShift cli (oc
).
You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in OpenShift Container Platform.
Create a KafkaChannel
object as a YAML file:
apiVersion: messaging.knative.dev/v1beta1
kind: KafkaChannel
metadata:
name: example-channel
namespace: default
spec:
numPartitions: 3
replicationFactor: 1
Only the |
Apply the KafkaChannel
YAML file:
$ oc apply -f <filename>
After you have created a channel, create a subscription that allows event sinks to subscribe to channels and receive events.
Configure event delivery parameters that are applied in cases where an event fails to be delivered to an event sink. See Examples of configuring event delivery parameters.