From 4f6fe9ba852d72be291040c041921db4a5e985be Mon Sep 17 00:00:00 2001 From: Ashleigh Brennan Date: Thu, 10 Jun 2021 17:57:32 -0500 Subject: [PATCH] #3078: Clean up Kafka docs --- docs/developer/eventing/kafka/README.md | 15 +++ docs/eventing/samples/kafka/README.md | 104 --------------------- docs/eventing/samples/kafka/kafka.yaml | 25 ----- docs/eventing/samples/kafka/kafka_setup.sh | 27 ------ mkdocs.yml | 3 + 5 files changed, 18 insertions(+), 156 deletions(-) create mode 100644 docs/developer/eventing/kafka/README.md delete mode 100644 docs/eventing/samples/kafka/README.md delete mode 100644 docs/eventing/samples/kafka/kafka.yaml delete mode 100755 docs/eventing/samples/kafka/kafka_setup.sh diff --git a/docs/developer/eventing/kafka/README.md b/docs/developer/eventing/kafka/README.md new file mode 100644 index 00000000000..59b962f0438 --- /dev/null +++ b/docs/developer/eventing/kafka/README.md @@ -0,0 +1,15 @@ +# Using Apache Kafka with Knative + +If you want to use Apache Kafka with Knative, you can either install Apache Kafka directly, use an existing Kafka cluster, or use [Strimzi](https://strimzi.io/docs/operators/in-development/full/overview.html) to create a simplified Kafka deployment on Kubernetes. + +## Prerequisites + +- You will need a Kubernetes cluster with [Knative Eventing installed](../../../../admin/install). + + !!! tip + You can use a `kind` cluster for local development and follow the [Getting Started](../../../../getting-started) documentation to install Knative by using the `konk` script. + +- If you do not have an existing Kafka cluster: + - [Install Strimzi](https://strimzi.io/docs/operators/in-development/quickstart.html#proc-install-product-str). + - [Create a Kafka cluster](https://strimzi.io/docs/operators/in-development/quickstart.html#proc-kafka-cluster-str). + - You can also use the [Strimzi Quickstart guide](https://strimzi.io/quickstarts/) to complete these tasks. diff --git a/docs/eventing/samples/kafka/README.md b/docs/eventing/samples/kafka/README.md deleted file mode 100644 index 1857447ccb0..00000000000 --- a/docs/eventing/samples/kafka/README.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -title: "Apache Kafka examples" -linkTitle: "Apache Kafka" -weight: 10 -type: "docs" ---- - -# Apache Kafka examples - -The following examples will help you understand how to use the different Apache -Kafka components for Knative. - -## Prerequisites - -All examples require: - -- A Kubernetes cluster with - - Knative Eventing v0.9+ - - Knative Serving v0.9+ -- An Apache Kafka cluster - -### Setting up Apache Kafka - -If you want to run the Apache Kafka cluster on Kubernetes, the simplest option -is to install it by using [Strimzi](https://strimzi.io). - -1. Create a namespace for your Apache Kafka installation, like `kafka`: - ```bash - kubectl create namespace kafka - ``` -1. Install the Strimzi operator, like: - ```bash - curl -L "https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.16.2/strimzi-cluster-operator-0.16.2.yaml" \ - | sed 's/namespace: .*/namespace: kafka/' \ - | kubectl -n kafka apply -f - - ``` -1. Describe the size of your Apache Kafka installation in `kafka.yaml`, like: - ```yaml - apiVersion: kafka.strimzi.io/v1beta2 - kind: Kafka - metadata: - name: my-cluster - spec: - kafka: - version: 2.4.0 - replicas: 1 - listeners: - plain: {} - tls: {} - config: - offsets.topic.replication.factor: 1 - transaction.state.log.replication.factor: 1 - transaction.state.log.min.isr: 1 - log.message.format.version: "2.4" - storage: - type: ephemeral - zookeeper: - replicas: 3 - storage: - type: ephemeral - entityOperator: - topicOperator: {} - userOperator: {} - ``` -1. Deploy the Apache Kafka cluster - ``` - $ kubectl apply -n kafka -f kafka.yaml - ``` - -This will install a small, non-production, cluster of Apache Kafka. To verify -your installation, check if the pods for Strimzi are all up, in the `kafka` -namespace: - -```bash -$ kubectl get pods -n kafka -NAME READY STATUS RESTARTS AGE -my-cluster-entity-operator-65995cf856-ld2zp 3/3 Running 0 102s -my-cluster-kafka-0 2/2 Running 0 2m8s -my-cluster-zookeeper-0 2/2 Running 0 2m39s -my-cluster-zookeeper-1 2/2 Running 0 2m49s -my-cluster-zookeeper-2 2/2 Running 0 2m59s -strimzi-cluster-operator-77555d4b69-sbrt4 1/1 Running 0 3m14s -``` - -> NOTE: For production ready installs check [Strimzi](https://strimzi.io). - -### Installation script - -If you want to install the latest version of Strimzi, in just one step, we have -a [script](./kafka_setup.sh) for your convenience, which does exactly the same -steps that are listed above: - -```bash -$ ./kafka_setup.sh -``` - -## Examples of Apache Kafka and Knative - -A number of different examples, showing the `KafkaSource`, `KafkaChannel` and -`KafkaBinding` can be found here: - -- [`KafkaSource` to `Service`](../../sources/kafka-source) -- [`KafkaChannel` and Broker](./channel/) -- [`KafkaBinding`](./binding/) diff --git a/docs/eventing/samples/kafka/kafka.yaml b/docs/eventing/samples/kafka/kafka.yaml deleted file mode 100644 index c98cca5b14e..00000000000 --- a/docs/eventing/samples/kafka/kafka.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: kafka.strimzi.io/v1beta2 -kind: Kafka -metadata: - name: my-cluster -spec: - kafka: - version: 2.4.0 - replicas: 1 - listeners: - plain: {} - tls: {} - config: - offsets.topic.replication.factor: 1 - transaction.state.log.replication.factor: 1 - transaction.state.log.min.isr: 1 - log.message.format.version: "2.4" - storage: - type: ephemeral - zookeeper: - replicas: 3 - storage: - type: ephemeral - entityOperator: - topicOperator: {} - userOperator: {} diff --git a/docs/eventing/samples/kafka/kafka_setup.sh b/docs/eventing/samples/kafka/kafka_setup.sh deleted file mode 100755 index 0d0fa51bb53..00000000000 --- a/docs/eventing/samples/kafka/kafka_setup.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -set -e -# Turn colors in this script off by setting the NO_COLOR variable in your -# environment to any value: -# -# $ NO_COLOR=1 test.sh -NO_COLOR=${NO_COLOR:-""} -if [ -z "$NO_COLOR" ]; then - header=$'\e[1;33m' - reset=$'\e[0m' -else - header='' - reset='' -fi -strimzi_version=`curl https://github.com/strimzi/strimzi-kafka-operator/releases/latest | awk -F 'tag/' '{print $2}' | awk -F '"' '{print $1}' 2>/dev/null` -function header_text { - echo "$header$*$reset" -} -header_text "Using Strimzi Version: ${strimzi_version}" -header_text "Strimzi install" -kubectl create namespace kafka -curl -L "https://github.com/strimzi/strimzi-kafka-operator/releases/download/${strimzi_version}/strimzi-cluster-operator-${strimzi_version}.yaml" \ - | sed 's/namespace: .*/namespace: kafka/' \ - | kubectl -n kafka apply -f - -header_text "Applying Strimzi Cluster file" -kubectl -n kafka apply -f "https://raw.githubusercontent.com/strimzi/strimzi-kafka-operator/${strimzi_version}/examples/kafka/kafka-ephemeral-single.yaml" - diff --git a/mkdocs.yml b/mkdocs.yml index cddfe4f12f9..b09c319b28e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -71,6 +71,8 @@ nav: - Configure resource requests and limits: developer/serving/services/configure-requests-limits-services.md - Troubleshooting: - Debugging application issues: developer/serving/troubleshooting/debugging-application-issues.md + - Knative Eventing: + - Using Apache Kafka with Knative: developer/eventing/kafka/README.md # Serving - Knative Serving: - Overview: serving/README.md @@ -292,6 +294,7 @@ plugins: # Redirects - redirects: redirect_maps: + 'eventing/samples/kafka/README.md': 'developer/eventing/kafka/README.md' 'help/README.md': 'docs/help/contributor/README.md' 'serving/metrics.md': 'admin/collecting-metrics/serving-metrics/metrics.md' 'eventing/metrics.md': 'admin/collecting-metrics/eventing-metrics/metrics.md'