<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Waqas Dilawar</title>
    <description>The latest articles on DEV Community by Waqas Dilawar (@waqasdilawar).</description>
    <link>https://dev.to/waqasdilawar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F441499%2F273c1412-8dec-406b-a7cf-6b71b5c3af06.png</url>
      <title>DEV Community: Waqas Dilawar</title>
      <link>https://dev.to/waqasdilawar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/waqasdilawar"/>
    <language>en</language>
    <item>
      <title>Get up and running Apache Kafka using Strimzi on Kubernetes</title>
      <dc:creator>Waqas Dilawar</dc:creator>
      <pubDate>Thu, 26 Aug 2021 06:21:16 +0000</pubDate>
      <link>https://dev.to/waqasdilawar/get-up-and-running-apache-kafka-using-strimzi-on-kubernetes-4c8j</link>
      <guid>https://dev.to/waqasdilawar/get-up-and-running-apache-kafka-using-strimzi-on-kubernetes-4c8j</guid>
      <description>&lt;p&gt;It's first post on series of blog posts on Apache Kafka using &lt;a href="https://strimzi.io/"&gt;Strimzi&lt;/a&gt; in Kubernetes. In this series we'll see how we can get up and running Apache Kafka using Strimzi on Kubernetes, export metrics, use exported metrics in &lt;a href="https://prometheus.io/"&gt;Prometheus&lt;/a&gt; and finally build beautiful graphs in &lt;a href="https://grafana.com/"&gt;Grafana&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Perquisites:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/"&gt;kubectl&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Welcome to Strimzi:&lt;/p&gt;

&lt;p&gt;Strimzi is an open source project licensed under Apache License 2.0 that is part of the &lt;a href="https://www.cncf.io/"&gt;Cloud Native Computing Foundation&lt;/a&gt; (CNCF) as a sandbox project. Its main focus is running &lt;a href="https://kafka.apache.org/"&gt;Apache Kafka&lt;/a&gt; on &lt;a href="https://kubernetes.io/"&gt;Kubernetes&lt;/a&gt; while providing container images for Apache Kafka itself, &lt;a href="https://zookeeper.apache.org/"&gt;Zookeeper&lt;/a&gt;, and other components that are part of the Strimzi ecosystem.&lt;/p&gt;

&lt;p&gt;Leveraging the &lt;a href="https://developers.redhat.com/topics/kubernetes/operators/"&gt;Kubernetes Operator&lt;/a&gt; pattern, it addresses the whole lifecycle from creating, managing, and monitoring Kafka clusters to managing all the related entities like topics and users. You get a real Kubernetes-native experience for handling all of the components in the Apache Kafka ecosystem.&lt;/p&gt;

&lt;p&gt;Get up and running Apache Kafka using Strimzi on Kubernetes:&lt;/p&gt;

&lt;p&gt;Follow the simple steps to install Strimzi Kafka on Kubernetes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install Strimzi Operator, before running this command please make sure to create kafka namespace.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;kubectl create -f 'https://strimzi.io/install/latest?namespace=kafka'&lt;/code&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NQTfDu-l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/75kwr5q0kthm3yt9kuwg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NQTfDu-l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/75kwr5q0kthm3yt9kuwg.png" alt="Command output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install basic Kafka cluster and Zookeeper with metrics enabled. We'll see in future post how we can use exported metrics in Prometheus and also build dashboard on top of those metrics in Grafana.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;kubectl apply -f https://github.com/waqasdilawar/strimzi-kafka-k8s/blob/main/kafka/01-strimzi-kafka-with-metrics.yaml -n kafka&lt;/code&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Rh5lfeUO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/00y3xjrwh26if9kj1syj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rh5lfeUO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/00y3xjrwh26if9kj1syj.png" alt="Command output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Try producing messages in a topic. Before producing message to a topic make sure you have Strimzi operator and it's different components are up and running as shown in below image.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--M8swi8EV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bzclmc6zazdaom1ksmc0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--M8swi8EV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bzclmc6zazdaom1ksmc0.png" alt="Everything is up and running"&gt;&lt;/a&gt;&lt;br&gt;
&lt;code&gt;kubectl -n kafka run kafka-producer -ti --image=quay.io/strimzi/kafka:0.25.0-kafka-2.8.0 --rm=true --restart=Never -- bin/kafka-console-producer.sh --broker-list my-cluster-kafka-bootstrap:9092 --topic my-topic&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In another terminal we can use a consumer to receive messages.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;kubectl -n kafka run kafka-consumer -ti --image=quay.io/strimzi/kafka:0.25.0-kafka-2.8.0 --rm=true --restart=Never -- bin/kafka-console-consumer.sh --bootstrap-server my-cluster-kafka-bootstrap:9092 --topic my-topic --from-beginning&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R6tFphRL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/37aj2mu1clbbq1cjc82i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R6tFphRL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/37aj2mu1clbbq1cjc82i.png" alt="Output of producer and consumer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enjoy your Apache Kafka cluster, running on Kubernetes!&lt;/p&gt;

&lt;p&gt;Reference: &lt;a href="https://github.com/waqasdilawar/strimzi-kafka-k8s"&gt;Source code&lt;/a&gt;, &lt;a href="https://strimzi.io/quickstarts/"&gt;Strimzi Quick start&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>kafka</category>
      <category>strimzi</category>
      <category>cloudnative</category>
    </item>
  </channel>
</rss>
