Installing Knative Eventing using YAML files

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

Prerequisites

Before installing Knative, you must meet the following prerequisites:

  • For prototyping purposes, Knative works on most local deployments of Kubernetes. For example, you can use a local, one-node cluster that has 2 CPUs and 4 GB of memory.

    Tip

    You can install a local distribution of Knative for development purposes using the Knative Quickstart plugin

  • For production purposes, it is recommended that:

    • If you have only one node in your cluster, you need at least 6 CPUs, 6 GB of memory, and 30 GB of disk storage.
    • If you have multiple nodes in your cluster, for each node you need at least 2 CPUs, 4 GB of memory, and 20 GB of disk storage.
    • You have a cluster that uses Kubernetes v1.22 or newer.
    • You have installed the kubectl CLI.
    • Your Kubernetes cluster must have access to the internet, because Kubernetes needs to be able to fetch images. To pull from a private registry, see Deploying images from a private container registry.

Caution

The system requirements provided are recommendations only. The requirements for your installation might vary, depending on whether you use optional components, such as a networking layer.

Install Knative Eventing

To install Knative Eventing:

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

    1. kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.4.2/eventing-crds.yaml
  2. Install the core components of Eventing by running the command:

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

    Info

    For information about the YAML files in Knative Eventing, see Description Tables for YAML Files.

Verify the installation

Success

Monitor the Knative components until all of the components show a STATUS of Running or Completed. You can do this by running the following command and inspecting the output:

  1. kubectl get pods -n knative-eventing

Example output:

  1. NAME READY STATUS RESTARTS AGE
  2. eventing-controller-7995d654c7-qg895 1/1 Running 0 2m18s
  3. eventing-webhook-fff97b47c-8hmt8 1/1 Running 0 2m17s

Optional: Install a default Channel (messaging) layer

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

Apache Kafka ChannelGoogle Cloud Pub/Sub ChannelIn-Memory (standalone)NATS Channel

  1. Install Strimzi.
  2. Install the Apache Kafka Channel for Knative from the knative-sandbox repository.
  • Install the Google Cloud Pub/Sub Channel by running the command:

    1. kubectl apply -f https://github.com/google/knative-gcp/releases/latest/download/cloud-run-events.yaml

    This command installs both the Channel and the GCP Sources.

    Tip

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

Warning

This simple standalone implementation runs in-memory and is not suitable for production use cases.

  • Install an in-memory implementation of Channel by running the command:

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

  2. Install the NATS Streaming Channel by running the command:

    1. kubectl apply -f https://github.com/knative-sandbox/eventing-natss/releases/download/knative-v1.4.0/eventing-natss.yaml

You can change the default channel implementation by following the instructions described in the Configure Channel defaults section.

Optional: Install a Broker layer

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

Apache Kafka BrokerMT-Channel-basedRabbitMQ Broker

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

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

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

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

For more information, see the Kafka Broker documentation.

This implementation of Broker uses Channels and runs event routing components in a system namespace, providing a smaller and simpler installation.

  • Install this implementation of Broker by running the command:

    1. kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.4.2/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. channel-template-spec: |
    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. channel-template-spec: |
    18. apiVersion: messaging.knative.dev/v1alpha1
    19. kind: KafkaChannel
    20. spec:
    21. numPartitions: 3
    22. replicationFactor: 1

Warning

In order to use the KafkaChannel, ensure that it is installed on your cluster, as mentioned previously in this topic.

For more information, see the RabbitMQ Broker in GitHub.

Install optional Eventing extensions

The following tabs expand to show instructions for installing each Eventing extension.

Apache Kafka SinkSugar ControllerGitHub SourceApache Kafka SourceGCP SourcesApache CouchDB SourceVMware Sources and Bindings

  1. Install the Kafka controller by running the command:

    1. kubectl apply -f https://github.com/knative-sandbox/eventing-kafka-broker/releases/download/knative-v1.4.3/eventing-kafka-controller.yaml
  2. Install the Kafka Sink data plane by running the command:

    1. kubectl apply -f https://github.com/knative-sandbox/eventing-kafka-broker/releases/download/knative-v1.4.3/eventing-kafka-sink.yaml

For more information, see the Kafka Sink documentation.

  1. Install the Eventing Sugar Controller by running the command:

    1. kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.4.2/eventing-sugar-controller.yaml

    The Knative Eventing Sugar Controller reacts to special labels and annotations and produce Eventing resources. For example:

    • When a namespace is labeled with eventing.knative.dev/injection=enabled, the controller creates a default Broker in that namespace.
    • When a Trigger is annotated with eventing.knative.dev/injection=enabled, the controller creates a Broker named by that Trigger in the Trigger’s namespace.
  2. Enable the default Broker on a namespace (here default) by running the command:

    1. kubectl label namespace <namespace-name> eventing.knative.dev/injection=enabled

    Where <namespace-name> is the name of the namespace.

A single-tenant GitHub source creates one Knative service per GitHub source.

A multi-tenant GitHub source only creates one Knative Service, which handles all GitHub sources in the cluster. This source does not support logging or tracing configuration.

  • To install a single-tenant GitHub source run the command:

    1. kubectl apply -f https://github.com/knative-sandbox/eventing-github/releases/download/knative-v1.4.1/github.yaml
  • To install a multi-tenant GitHub source run the command:

    1. kubectl apply -f https://github.com/knative-sandbox/eventing-github/releases/download/knative-v1.4.1/mt-github.yaml

To learn more, try the GitHub source sample

  • Install the Apache Kafka Source by running the command:

    1. kubectl apply -f https://github.com/knative-sandbox/eventing-kafka/releases/download/knative-v1.4.1/source.yaml

To learn more, try the Apache Kafka source sample.

  • Install the GCP Sources by running the command:

    1. kubectl apply -f https://github.com/google/knative-gcp/releases/latest/download/cloud-run-events.yaml

    This command installs both the Sources and the Channel.

To learn more, try the following samples:

To learn more, read the Apache CouchDB source documentation.

  • Install VMware Sources and Bindings by running the command:

    1. kubectl apply -f https://github.com/vmware-tanzu/sources-for-knative/releases/download/v0.31.0/release.yaml

To learn more, try the VMware sources and bindings samples.