// Module included in the following assemblies:
//
//  * serverless/event_workflows/serverless-channels.adoc

[id="serverless-creating-subscriptions-kn_{context}"]
= Creating subscriptions using the Knative CLI

You can create a subscription to connect a channel to a sink by using the `kn` CLI.

.Prerequisites

To create subscriptions using the `kn` CLI, ensure that:

* The {ServerlessOperatorName} and Knative Eventing are installed on your {product-title} cluster.
* You have installed the `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 {product-title}.

.Procedure

* Create a subscription to connect a sink to a channel.
+
[source,terminal]
----
$ kn subscription create <subscription_name> \
  --channel <Group:Version:Kind>:<channel_name> \
  --sink <sink_prefix>:<sink_name> \
  --sink-reply <sink_prefix>:<sink_name> \
  --sink-dead-letter <sink_prefix>:<sink_name>
----
+
.Example command
[source,terminal]
----
$ kn subscription create mysubscription --channel mychannel --sink ksvc:event-display
----
+
.Example output
[source,terminal]
----
Subscription 'mysubscription' created in namespace 'default'.
----

.Verification steps

* To confirm that the channel is connected to the event sink, or _subscriber_, by a subscription, list the existing subscriptions and inspect the output:
+
[source,terminal]
----
$ kn subscription list
----
+
.Example output
[source,terminal]
----
NAME            CHANNEL             SUBSCRIBER           REPLY   DEAD LETTER SINK   READY   REASON
mysubscription   Channel:mychannel   ksvc:event-display                              True
----
