Installing Knative Eventing using YAML files

This topic describes how to install Knative Eventing by applying YAML files using the kubectl CLI.

Prerequisites

Before installation, you must meet the prerequisites. See Knative Prerequisites.

Install the Eventing component

To install the Eventing component:

  1. Install the required custom resource definitions (CRDs):

    1. kubectl apply -f https://github.com/knative/eventing/releases/download/v0.23.0/eventing-crds.yaml
  2. Install the core components of Eventing:

    1. kubectl apply -f https://github.com/knative/eventing/releases/download/v0.23.0/eventing-core.yaml

For information about the YAML files in the Knative Serving and Eventing releases, see Installation files.

Verify the installation

Monitor the Knative components until all of the components show a STATUS of Running:

  1. kubectl get pods --namespace knative-eventing

Optional: Install a default channel (messaging) layer

The tabs below expand to show instructions for installing a default channel layer. Follow the procedure for the channel of your choice:

  1. First, Install Apache Kafka for Kubernetes

  2. Then install the Apache Kafka channel:

    1. curl -L "https://github.com/knative-sandbox/eventing-kafka/releases/download/v0.23.0/channel-consolidated.yaml" \
    2. | sed 's/REPLACE_WITH_CLUSTER_URL/my-cluster-kafka-bootstrap.kafka:9092/' \
    3. | kubectl apply -f -

To learn more about the Apache Kafka channel, try our sample

  1. Install the Google Cloud Pub/Sub channel:

    1. # This installs both the Channel and the GCP Sources.
    2. kubectl apply -f https://github.com/google/knative-gcp/releases/download/v0.23.0/cloud-run-events.yaml

To learn more about the Google Cloud Pub/Sub channel, try our sample

The following command installs an implementation of channel that runs in-memory. This implementation is nice because it is simple and standalone, but it is unsuitable for production use cases.

  1. kubectl apply -f https://github.com/knative/eventing/releases/download/v0.23.0/in-memory-channel.yaml
  1. First, Install NATS Streaming for Kubernetes

  2. Then install the NATS Streaming channel:

    1. kubectl apply -f https://github.com/knative-sandbox/eventing-natss/releases/download/v0.23.0/300-natss-channel.yaml

Optional: Install a broker layer:

The tabs below expand to show instructions for installing the broker layer. Follow the procedure for the broker of your choice:

The following commands install the Apache Kafka broker, and run event routing in a system namespace, knative-eventing, by default.

  1. Install the Kafka controller by entering the following command:

    1. kubectl apply -f https://github.com/knative-sandbox/eventing-kafka-broker/releases/download/v0.23.0/eventing-kafka-controller.yaml
  2. Install the Kafka broker data plane by entering the following command:

    1. kubectl apply -f https://github.com/knative-sandbox/eventing-kafka-broker/releases/download/v0.23.0/eventing-kafka-broker.yaml

For more information, see the Kafka broker documentation.

The following command installs an implementation of broker that utilizes channels and runs event routing components in a System Namespace, providing a smaller and simpler installation.

  1. kubectl apply -f https://github.com/knative/eventing/releases/download/v0.23.0/mt-channel-broker.yaml

To customize which broker channel implementation is used, update the following ConfigMap to specify which configurations are used for which namespaces:

  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: config-br-defaults
  5. namespace: knative-eventing
  6. data:
  7. default-br-config: |
  8. # This is the cluster-wide default broker channel.
  9. clusterDefault:
  10. brokerClass: MTChannelBasedBroker
  11. apiVersion: v1
  12. kind: ConfigMap
  13. name: imc-channel
  14. namespace: knative-eventing
  15. # This allows you to specify different defaults per-namespace,
  16. # in this case the "some-namespace" namespace will use the Kafka
  17. # channel ConfigMap by default (only for example, you will need
  18. # to install kafka also to make use of this).
  19. namespaceDefaults:
  20. some-namespace:
  21. brokerClass: MTChannelBasedBroker
  22. apiVersion: v1
  23. kind: ConfigMap
  24. name: kafka-channel
  25. namespace: knative-eventing

The referenced imc-channel and kafka-channel example ConfigMaps would look like:

  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: imc-channel
  5. namespace: knative-eventing
  6. data:
  7. channelTemplateSpec: |
  8. apiVersion: messaging.knative.dev/v1
  9. kind: InMemoryChannel
  10. ---
  11. apiVersion: v1
  12. kind: ConfigMap
  13. metadata:
  14. name: kafka-channel
  15. namespace: knative-eventing
  16. data:
  17. channelTemplateSpec: |
  18. apiVersion: messaging.knative.dev/v1alpha1
  19. kind: KafkaChannel
  20. spec:
  21. numPartitions: 3
  22. replicationFactor: 1

NOTE: In order to use the KafkaChannel make sure it is installed on the cluster as discussed above.

Next steps

After installing Knative Eventing: