Self-hosted Kafka
Learn how to set up a self-hosted Kafka cluster for Seldon Core in development and learning environments.
You can run Kafka in the same Kubernetes cluster that hosts the Seldon Core 2. Seldon recommends using the Strimzi operator for Kafka installation and maintenance. For more details about configuring Kafka with Seldon Core 2 see the Configuration section.
Integrating self-hosted Kafka with Seldon Core 2 includes these steps:
Installing Kafka in a Kubernetes cluster
Strimzi provides a Kubernetes Operator to deploy and manage Kafka clusters. First, we need to install the Strimzi Operator in your Kubernetes cluster.
Create a namespace where you want to install Kafka. For example the namespace
seldon-mesh:kubectl create namespace seldon-mesh || echo "namespace seldon-mesh exists"Install Strimzi.
helm repo add strimzi https://strimzi.io/charts/ helm repo updateInstall Strimzi Operator.
helm install strimzi-kafka-operator strimzi/strimzi-kafka-operator --namespace seldon-meshThis deploys the
Strimzi Operatorin theseldon-meshnamespace. After the Strimzi Operator is running, you can create a Kafka cluster by applying a Kafka custom resource definition.Create a YAML file to specify the initial configuration.
Note: This configuration sets up a Kafka cluster with version 3.9.0. Ensure that you review the the supported versions of Kafka and update the version in the
kafka.yamlfile as needed. For more configuration examples, see this strimzi-kafka-operator.Use your preferred text editor to create and save the file as
kafka.yamlwith the following content:
Apply the Kafka cluster configuration.
Create a YAML file named
kafka-nodepool.yamlto create a nodepool for the kafka cluster.
Apply the Kafka node pool configuration.
Check the status of the Kafka Pods to ensure they are running properly:
You should see multiple Pods for Kafka, and Strimzi operators running.
Troubleshooting
Error
The Pod that begins with the name seldon-dataflow-engine does not show the status as Running.
One of the possible reasons could be that the DNS resolution for the service failed.
Solution
Check the logs of the Pod
<seldon-dataflow-engine>:In the output check if a message reads:
Verify the
namein themetadatafor thekafka.yamlandkafka-nodepool.yaml. It should readseldon.Check the name of the Kafka services in the namespace:
Restart the Pod:
Configuring Seldon Core 2
When the SeldonRuntime is installed in a namespace a ConfigMap is created with the
settings for Kafka configuration. Update the ConfigMap only if you need to customize the configurations.
Unexpected error with integration github-files: Integration is not installed on this space
Verify that the ConfigMap resource named
seldon-kafkathat is created in the namespaceseldon-mesh:You should have the ConfigMaps for Kafka, Zookeeper, Strimzi operators, and others.
View the configuration of the the ConfigMap named
seldon-kafka.You should see an output similar to this:
After you integrated Seldon Core 2 with Kafka, you need to Install an Ingress Controller that adds an abstraction layer for traffic routing by receiving traffic from outside the Kubernetes platform and load balancing it to Pods running within the Kubernetes cluster.
Customizing the settings (optional)
To customize the settings you can add and modify the Kafka configuration using Helm, for example to add compression for producers.
Create a YAML file to specify the compression configuration for Seldon Core 2 runtime. For example, create the
values-runtime-kafka-compression.yamlfile. Use your preferred text editor to create and save the file with the following content:
Unexpected error with integration github-files: Integration is not installed on this space
Change to the directory that contains the
values-runtime-kafka-compression.yamlfile and then install Seldon Core 2 runtime in the namespaceseldon-mesh.
Configuring topic and consumer isolation (optional)
If you are using a shared Kafka cluster with other applications, it is advisable to isolate topic names and consumer group IDs from other cluster users to prevent naming conflicts. This can be achieved by configuring the following two settings:
topicPrefix: set a prefix for all topicsconsumerGroupIdPrefix: set a prefix for all consumer groups
Here's an example of how to configure topic name and consumer group ID isolation during a Helm installation for an application named myorg:
Next Steps
After you installed Seldon Core 2, and Kafka using Helm, you need to complete Installing a Service mesh.
Last updated
Was this helpful?

