Setup KPOps¶
In this part, you will set up KPOps. This includes:
- optionally creating a local Kubernetes cluster
- running Apache Kafka and Confluent's Schema Registry
- installing KPOps
Prerequisites¶
- k3d (Version 5.4.6+) and Docker (Version >= v20.10.5) or an existing Kubernetes cluster (>= 1.21.0)
- kubectl (Compatible with server version 1.21.0)
- Helm (Version 3.8.0+)
Setup Kubernetes with k3d¶
If you don't have access to an existing Kubernetes cluster, this section will guide you through creating a local cluster. We recommend the lightweight Kubernetes distribution k3s for this. k3d is a wrapper around k3s in Docker that lets you get started fast.
-
You can install k3d with its installation script:
For other ways of installing k3d, you can have a look at their installation guide.
-
The Kafka deployment needs a modified Docker image. In that case the image is built and pushed to a Docker registry that holds it. If you do not have access to an existing Docker registry, you can use k3d's Docker registry:
-
Now you can create a new cluster called
kpops
that uses the previously created Docker registry:
Note
Creating a new k3d cluster automatically configures kubectl
to connect to the local cluster by modifying your ~/.kube/config
. In case you manually set the KUBECONFIG
variable or don't want k3d to modify your config, k3d offers many other options.
You can check the cluster status with kubectl get pods -n kube-system
. If all returned elements have a STATUS
of Running
or Completed
, then the cluster is up and running.
Deploy Kafka¶
Kafka is an open-source data streaming platform. More information about Kafka can be found in the documentation. To deploy Kafka, this guide uses Confluent's Helm chart.
-
To allow connectivity to other systems Kafka Connect needs to be extended with drivers. You can install a JDBC driver for Kafka Connect by creating a new Docker image:
-
Create a
Dockerfile
with the following content: -
Build and push the modified image to your private Docker registry:
Detailed instructions on building, tagging and pushing a docker image can be found in Docker docs.
-
-
Add Confluent's Helm chart repository and update the index:
-
Install Kafka, Zookeeper, Confluent's Schema Registry, Kafka Rest Proxy, and Kafka Connect. A single Helm chart installs all five components. Below you can find an example for the
--values ./kafka.yaml
file configuring the deployment accordingly. Deploy the services:
Kafka Helm chart values (kafka.yaml
)
An example value configuration for Confluent's Helm chart. This configuration deploys a single Kafka Broker, a Schema Registry, Zookeeper, Kafka Rest Proxy, and Kafka Connect with minimal resources.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
Deploy Streams Explorer¶
Streams Explorer allows examining Apache Kafka data pipelines in a Kubernetes cluster including the inspection of schemas and monitoring of metrics. First, add the Helm repository:
Below you can find an example for the --values ./streams-explorer.yaml
file configuring the deployment accordingly. Now, deploy the service:
Streams Explorer Helm chart values (streams-explorer.yaml
)
An example value configuration for Steams Explorer Helm chart.
Check the status of your deployments¶
Now we will check if all the pods are running in our namespace. You can list all pods in the namespace with this command:
Then you should see the following output in your terminal:
Pay attention to the STATUS
row. The pods should have a status of Running
.
Install KPOps¶
KPOps comes as a PyPI package. You can install it with pip
: