Channel types and defaults

Knative uses two types of Channels:

  • A generic Channel object.
  • Channel implementations that each have their own custom resource definitions (CRDs), such as InMemoryChannel and KafkaChannel. The KafkaChannel supports an ordered consumer delivery guarantee, which is a per-partition blocking consumer that waits for a successful response from the CloudEvent subscriber before it delivers the next message of the partition.

Custom Channel implementations each have their own event delivery mechanisms, such as in-memory or Broker-based. Examples of Brokers include KafkaBroker and the GCP Pub/Sub Broker.

Knative provides the InMemoryChannel Channel implementation by default. This default implementation is useful for developers who do not want to configure a specific implementation type, such as Apache Kafka or NATSS Channels.

You can use the generic Channel object if you want to create a Channel without specifying which Channel implementation CRD is used. This is useful if you do not care about the properties a particular Channel implementation provides, such as ordering and persistence, and you want to use the implementation selected by the cluster administrator.

Cluster administrators can modify the default Channel implementation settings by editing the default-ch-webhook ConfigMap in the knative-eventing namespace.

For more information about modifying ConfigMaps, see Configuring the Eventing Operator custom resource.

Default Channels can be configured for the cluster, a namespace on the cluster, or both.

Note

If a default Channel implementation is configured for a namespace, this will overwrite the configuration for the cluster.

In the following example, the cluster default Channel implementation is InMemoryChannel, while the namespace default Channel implementation for the example-namespace is KafkaChannel.

  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: default-ch-webhook
  5. namespace: knative-eventing
  6. data:
  7. default-ch-config: |
  8. clusterDefault:
  9. apiVersion: messaging.knative.dev/v1
  10. kind: InMemoryChannel
  11. namespaceDefaults:
  12. example-namespace:
  13. apiVersion: messaging.knative.dev/v1beta1
  14. kind: KafkaChannel
  15. spec:
  16. numPartitions: 2
  17. replicationFactor: 1

Note

InMemoryChannel Channels must not be used in production environments.

Next steps