Installing Knative Eventing using YAML files
Before installation, you must meet the prerequisites. See Knative Prerequisites.
Install the Eventing component
To install the Eventing component:
Install the required custom resource definitions (CRDs):
Install the core components of Eventing:
kubectl apply -f https://github.com/knative/eventing/releases/download/v0.22.0/eventing-core.yaml
For information about the YAML files in the Knative Serving and Eventing releases, see Installation files.
Monitor the Knative components until all of the components show a STATUS
of Running
:
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:
-
curl -L "https://github.com/knative-sandbox/eventing-kafka/releases/download/v0.22.0/channel-consolidated.yaml" \
| sed 's/REPLACE_WITH_CLUSTER_URL/my-cluster-kafka-bootstrap.kafka:9092/' \
| kubectl apply -f -
To learn more about the Apache Kafka channel, try
Install the Google Cloud Pub/Sub channel:
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.
kubectl apply -f https://github.com/knative/eventing/releases/download/v0.22.0/in-memory-channel.yaml
First,
Then install the NATS Streaming channel:
kubectl apply -f https://github.com/knative-sandbox/eventing-natss/releases/download/v0.22.0/300-natss-channel.yaml
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.
Install the Kafka broker data plane by entering the following command:
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.
kubectl apply -f https://github.com/knative/eventing/releases/download/v0.22.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:
apiVersion: v1
kind: ConfigMap
metadata:
name: config-br-defaults
namespace: knative-eventing
data:
default-br-config: |
# This is the cluster-wide default broker channel.
brokerClass: MTChannelBasedBroker
apiVersion: v1
kind: ConfigMap
name: imc-channel
namespace: knative-eventing
# This allows you to specify different defaults per-namespace,
# in this case the "some-namespace" namespace will use the Kafka
# channel ConfigMap by default (only for example, you will need
# to install kafka also to make use of this).
namespaceDefaults:
some-namespace:
brokerClass: MTChannelBasedBroker
apiVersion: v1
kind: ConfigMap
namespace: knative-eventing
The referenced imc-channel
and kafka-channel
example ConfigMaps would look like:
apiVersion: v1
kind: ConfigMap
name: imc-channel
namespace: knative-eventing
data:
channelTemplateSpec: |
apiVersion: messaging.knative.dev/v1
kind: InMemoryChannel
---
apiVersion: v1
kind: ConfigMap
metadata:
name: kafka-channel
namespace: knative-eventing
data:
channelTemplateSpec: |
apiVersion: messaging.knative.dev/v1alpha1
kind: KafkaChannel
spec:
numPartitions: 3
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:
To easily interact with Knative Eventing components, install the
kn
CLI