{"id":2093,"date":"2022-02-11T08:17:19","date_gmt":"2022-02-11T08:17:19","guid":{"rendered":"https:\/\/blog.samarthya.me\/wps\/?p=2093"},"modified":"2022-02-25T06:20:13","modified_gmt":"2022-02-25T06:20:13","slug":"kafka-deploy-test","status":"publish","type":"post","link":"https:\/\/blog.samarthya.me\/wps\/2022\/02\/11\/kafka-deploy-test\/","title":{"rendered":"Kafka: Deploy &#038; Test"},"content":{"rendered":"\n<p>While I continue to learn more about architecture and design of <code>kafka<\/code>, a quickstart to deploy &amp; test kafka is a must. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-1-add-chart-repo\">Step 1: Add Chart Repo<\/h2>\n\n\n\n<p>In my local system it is already present which was confirmed by the listing<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@master&gt;helm repo list\nNAME                    URL                                                                                         \nstable                  https:\/\/charts.helm.sh\/stable                                                               \nelastic                 https:\/\/helm.elastic.co                                                                     \nbitnami                 https:\/\/charts.bitnami.com\/bitnami  <\/code><\/pre>\n\n\n\n<p>In your case you will have to <code>add<\/code> the repo.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>helm repo add bitnami https:\/\/charts.bitnami.com\/bitnami<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-2-deploy-the-chart\">Step 2: Deploy the chart<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>helm install my-release bitnami\/kafka<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-12.47.07-PM-1024x511.png\" alt=\"\" class=\"wp-image-2094\" width=\"840\" height=\"419\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-12.47.07-PM-1024x511.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-12.47.07-PM-300x150.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-12.47.07-PM-1536x766.png 1536w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-12.47.07-PM-2048x1021.png 2048w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-12.47.07-PM-300x150@2x.png 600w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><figcaption>Installation<\/figcaption><\/figure>\n\n\n\n<p>The output identifies the steps you can use to validate the deployment, you can customize as per your needs for the quick test.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-3-console-producer\">Step 3: Console Producer<\/h2>\n\n\n\n<p>Before you test you will need to have a client that can produce the events for a specific <a rel=\"noreferrer noopener\" href=\"https:\/\/kafka.apache.org\/documentation\/#topicconfigs\" target=\"_blank\">topic<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl run my-release-kafka-client --restart='Never' --image docker.io\/bitnami\/kafka:3.1.0-debian-10-r14 --namespace default --command -- sleep infinity<\/code><\/pre>\n\n\n\n<p>You can check the running pod by issuing <code>kubectl get pods<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>my-release-kafka-client                               1\/1     Running   0             22m<\/code><\/pre>\n\n\n\n<p>Get into to the pod<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> kubectl exec --tty -i my-release-kafka-client --namespace default -- bash<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img decoding=\"async\" width=\"1024\" height=\"149\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-1.35.37-PM-1024x149.png\" alt=\"\" class=\"wp-image-2095\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-1.35.37-PM-1024x149.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-1.35.37-PM-300x44.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-1.35.37-PM-1536x223.png 1536w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-1.35.37-PM-2048x297.png 2048w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-1.35.37-PM-300x44@2x.png 600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Producer<\/figcaption><\/figure>\n\n\n\n<p>You can either use the same command as outputted by the Helm Install message for validation <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kafka-console-producer.sh \\\n            --broker-list my-release-kafka-0.my-release-kafka-headless.default.svc.cluster.local:9092 \\\n            --topic test<\/code><\/pre>\n\n\n\n<p>Or customize as per your wish<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; kafka-console-producer.sh --broker-list my-release-kafka-0.my-release-kafka-headless.default.svc.cluster.local:9092 --topic mytopic<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-4-console-consumer\">Step 4: Console Consumer<\/h2>\n\n\n\n<p>The information you feed in the producer can be consumed by the client consumer. For that, log into the client<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> kubectl exec --tty -i my-release-kafka-client --namespace default -- bash<\/code><\/pre>\n\n\n\n<p>And listen to the topic<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kafka-console-consumer.sh \\\n            --bootstrap-server my-release-kafka.default.svc.cluster.local:9092 \\\n            --topic test \\\n            --from-beginning<\/code><\/pre>\n\n\n\n<p>Or for <code>mytopic<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kafka-console-consumer.sh --bootstrap-server my-release-kafka.default.svc.cluster.local:9092 --topic mytopic   <\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img decoding=\"async\" width=\"1024\" height=\"165\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-1.35.49-PM-1024x165.png\" alt=\"\" class=\"wp-image-2096\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-1.35.49-PM-1024x165.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-1.35.49-PM-300x48.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-1.35.49-PM-1536x247.png 1536w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-1.35.49-PM-2048x329.png 2048w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2022\/02\/Screenshot-2022-02-11-at-1.35.49-PM-300x48@2x.png 600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Consumer<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-pullquote has-white-color has-black-background-color has-text-color has-background\"><blockquote><p>Learn more about use cases <a href=\"https:\/\/kafka.apache.org\/powered-by\">here<\/a>.<\/p><cite>official documentation<\/cite><\/blockquote><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>While I continue to learn more about architecture and design of kafka, a quickstart to deploy &amp; test kafka is a must. Step 1: Add Chart Repo In my local system it is already present which was confirmed by the listing In your case you will have to add the repo. Step 2: Deploy the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":2094,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[195,34],"tags":[238,106,225],"class_list":["post-2093","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-kubernetes","category-technical","tag-deploy","tag-helm","tag-kafka","post_format-post-format-image"],"_links":{"self":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/2093","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/comments?post=2093"}],"version-history":[{"count":0,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/2093\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media\/2094"}],"wp:attachment":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media?parent=2093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/categories?post=2093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/tags?post=2093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}