{
    "componentChunkName": "component---src-pages-blog-post-tsx",
    "path": "/blog/2021-01-26/kafka-docker-tutorial",
    "result": {"data":{"site":{"siteMetadata":{"siteUrl":"https://www.architect.io"}},"allMdx":{"edges":[{"node":{"body":"var _excluded = [\"components\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"Get Started with Kafka and Docker in 20 Minutes\",\n  \"description\": \"Follow this tutorial to deploy and connect to a Kafka service to broker communication between Dockerized Node.js microservices.\",\n  \"keywords\": \"kafka docker\",\n  \"slug\": \"kafka-docker-tutorial\",\n  \"date\": \"2021-01-26T00:00:00.000Z\",\n  \"author\": \"Ryan Cahill\",\n  \"image\": \"./kafka-docker.png\"\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"Apache Kafka is a high-throughput, high-availability, and scalable solution chosen by the world's\\ntop companies for uses such as event streaming, stream processing, log aggregation, and more. Kafka\\nruns on the platform of your choice, such as Kubernetes or ECS, as a cluster of one or more Kafka\\nnodes. A Kafka cluster will be initialized with zero or more topics, which you can think of as\\nmessage channels or queues. Clients can connect to Kafka to publish messages to topics or to consume\\nmessages from topics the client is subscribed to.\"), mdx(\"p\", null, \"Docker is an application that uses virtualization to run containerized applications on a host\\nmachine. Containerization enables users to build, run, and test applications completely separately\\nwhile still allowing them to communicate across a network. Importantly, containerization enables\\napplication portability so that the same application can be run on your local machine, a Kubernetes\\ncluster, AWS, and more.\"), mdx(\"p\", null, \"Both Kafka and Docker are pretty complex technologies, and it can be difficult to determine where to\\nget started once you're sure that they're the right fit for the problem you're solving. To keep\\nthings simple, we'll create one producer, one consumer, and one Kafka instance.\"), mdx(\"h2\", {\n    \"id\": \"project-dependencies-for-kafka-and-docker\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Project dependencies for Kafka and Docker\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#project-dependencies-for-kafka-and-docker\",\n    \"aria-label\": \"project dependencies for kafka and docker permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"In this tutorial, we'll start by using \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://docs.docker.com/compose/\"\n  }, \"Docker Compose\"), \" to build,\\nrun, and test locally. We'll also walk through how to use\\n\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://kubernetes.io/docs/reference/kubectl/overview/\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"kubectl\")), \" to deploy our application to the\\ncloud. Last, we'll walk through how we can use \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://www.architect.io/\"\n  }, \"Architect\"), \" to seamlessly\\ndeploy our application locally and to the cloud using the same configuration. Before getting\\nstarted, be sure to have the following dependencies installed locally:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://docs.docker.com/get-docker/\"\n  }, \"Docker\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://docs.docker.com/compose/install/\"\n  }, \"Docker-compose\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://hub.docker.com/signup\"\n  }, \"A Docker Hub account\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://www.npmjs.com/get-npm\"\n  }, \"npm\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://www.npmjs.com/package/@architect-io/cli\"\n  }, \"Architect CLI\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://kubernetes.io/docs/tasks/tools/install-kubectl/\"\n  }, \"kubectl\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://cloud.digitalocean.com/registrations/new\"\n  }, \"A Kubernetes cluster on DigitalOcean or elsewhere\"))), mdx(\"p\", null, \"As mentioned previously, this part of the tutorial will contain multiple services running on your\\nlocal machine. You can use \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"docker-compose\"), \" to run them all at once and stop them all when you're\\nready. Let\\u2019s get going!\"), mdx(\"h2\", {\n    \"id\": \"build-the-publisher-service-in-node-for-kafka-with-docker\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Build the publisher service in Node for Kafka with Docker\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#build-the-publisher-service-in-node-for-kafka-with-docker\",\n    \"aria-label\": \"build the publisher service in node for kafka with docker permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"Start by creating a project directory with two folders inside it named \\\"subscriber\\\" and \\\"publisher.\\u201D\\nThese folders will contain the application code, supporting Node files, and Dockerfiles that will be\\nneeded to build the apps that will communicate with Kafka.\"), mdx(\"p\", null, \"The publisher service will be the one that generates messages that will be published to a Kafka\\ntopic. For simplicity, the service will generate a simple message at an interval of five seconds.\\nInside of the \\\"publisher\\\" folder, add a new file called index.js with the following contents:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"js\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-js\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-js\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" kafka \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"require\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'kafka-node'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" client \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"new\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token class-name\"\n  }, \"kafka\", mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"KafkaClient\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n  kafkaHost\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \"\\n    process\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"env\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token constant\"\n  }, \"ENVIRONMENT\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"===\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'local'\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"?\"), \" process\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"env\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token constant\"\n  }, \"INTERNAL_KAFKA_ADDR\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" process\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"env\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token constant\"\n  }, \"EXTERNAL_KAFKA_ADDR\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" Producer \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"Producer\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" producer \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"new\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token class-name\"\n  }, \"Producer\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), \"client\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\\nproducer\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"on\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'ready'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=>\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"setInterval\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=>\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" payloads \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"[\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n        topic\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" process\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"env\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token constant\"\n  }, \"TOPIC\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n        messages\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"[\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token template-string\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token template-punctuation string\"\n  }, \"`\"), mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token interpolation\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token interpolation-punctuation punctuation\"\n  }, \"${\"), \"process\", mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"env\", mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token constant\"\n  }, \"TOPIC\"), mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token interpolation-punctuation punctuation\"\n  }, \"}\")), mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token string\"\n  }, \"_message_\"), mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token interpolation\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token interpolation-punctuation punctuation\"\n  }, \"${\"), \"Date\", mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token function\"\n  }, \"now\"), mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token interpolation-punctuation punctuation\"\n  }, \"}\")), mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token template-punctuation string\"\n  }, \"`\")), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"]\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"]\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\\n    producer\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"send\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), \"payloads\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token parameter\"\n  }, \"err\", mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" data\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=>\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"if\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), \"err\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n        console\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"log\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), \"err\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n      console\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"log\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), \"data\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"5000\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\\nproducer\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"on\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'error'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token parameter\"\n  }, \"err\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=>\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n  console\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"log\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), \"err\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\")))), mdx(\"p\", null, \"Save and close the index. We'll also need some supporting modules installed to our Docker container\\nwhen it's built. Also, in the \\\"publisher\\\" folder, create a \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"package.json\"), \" with the JSON here:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"json\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-json\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"name\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"publisher\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"version\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"0.1.0\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"main\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"index.js\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"scripts\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"start\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"node index.js\\\"\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"license\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"ISC\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"dependencies\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"body-parser\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"^1.19.0\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"cors\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"2.8.5\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"express\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"^4.17.1\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"kafka-node\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"^5.0.0\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"winston\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"^3.2.1\\\"\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\")))), mdx(\"p\", null, \"Save and close the package.json. Alongside the last two files, we'll need a \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"package-lock.json\"), \",\\nwhich can be created with the following command:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"npm\"), \" i --package-lock-only\"))), mdx(\"p\", null, \"The last file to create for the publisher will pull everything together, and that's the Dockerfile.\\nCreate the Dockerfile alongside the other three files that were just created and add the following:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"docker\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-docker\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-docker\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"FROM\"), \" node:12-alpine\"), \"\\n\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"WORKDIR\"), \" /usr/src/app\"), \"\\n\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"COPY\"), \" package*.json ./\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"RUN\"), \" npm install\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"COPY\"), \" . .\"), \"\\n\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"CMD\"), \" [ \", mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token string\"\n  }, \"\\\"npm\\\"\"), \", \", mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token string\"\n  }, \"\\\"start\\\"\"), \" ]\")))), mdx(\"p\", null, \"Save and close the file. Line by line, the Dockerfile that was just added to the folder will\\ninstruct the Docker daemon to build the publisher image like so:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Pull the Docker image \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"node:12-alpine\"), \" as the base container image\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Set the working directory to \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"/usr/src/app\"), \". Subsequent commands will be run in this folder\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Copy the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"package.json\"), \" and \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"package-lock.json\"), \" that were just created into the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"/usr/src/app\"), \"\\ndirectory\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Run \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"npm install\"), \" to install node modules\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Copy the rest of the files from the directory on the home machine to \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"/usr/src/app\"), \". Importantly,\\nthis includes the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"index.js\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Run the command \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"npm start\"), \" in the container. \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"npm\"), \" is already installed on the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"node:12-alpine\"), \"\\nimage, and the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"start\"), \" script is defined in the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"package.json\"))), mdx(\"h2\", {\n    \"id\": \"build-the-subscriber-service-for-kafka-with-docker\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Build the subscriber service for Kafka with Docker\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#build-the-subscriber-service-for-kafka-with-docker\",\n    \"aria-label\": \"build the subscriber service for kafka with docker permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"The subscriber service will be built very similarly to the publisher service and will consume\\nmessages from the Kafka topic. Messages will be consumed as frequently as they're published, again,\\nevery five seconds in this case. To start, add a file titled \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"index.js\"), \" to the \\\"subscriber\\\" folder\\nand add the following code:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"js\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-js\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-js\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" kafka \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"require\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'kafka-node'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" client \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"new\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token class-name\"\n  }, \"kafka\", mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"KafkaClient\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n  kafkaHost\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \"\\n    process\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"env\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token constant\"\n  }, \"ENVIRONMENT\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"===\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'local'\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"?\"), \" process\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"env\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token constant\"\n  }, \"INTERNAL_KAFKA_ADDR\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" process\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"env\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token constant\"\n  }, \"EXTERNAL_KAFKA_ADDR\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" Consumer \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"Consumer\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" consumer \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"new\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token class-name\"\n  }, \"Consumer\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), \"\\n  client\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"[\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n      topic\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" process\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"env\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token constant\"\n  }, \"TOPIC\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n      partition\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"0\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"]\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n    autoCommit\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token boolean\"\n  }, \"false\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\\nconsumer\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"on\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'message'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token parameter\"\n  }, \"message\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=>\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n  console\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"log\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), \"message\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\\nconsumer\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"on\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'error'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token parameter\"\n  }, \"err\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=>\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n  console\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"log\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), \"err\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\")))), mdx(\"p\", null, \"Save and close the index. Also, similar to the publisher, we'll need a package.json file like this:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"json\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-json\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"name\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"subscriber\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"version\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"0.1.0\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"main\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"index.js\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"scripts\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"start\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"node index.js\\\"\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"author\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"Architect.io\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"license\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"ISC\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"dependencies\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"body-parser\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"^1.19.0\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"cors\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"2.8.5\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"express\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"^4.17.1\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"kafka-node\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"^5.0.0\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token property\"\n  }, \"\\\"winston\\\"\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"\\\"^3.2.1\\\"\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\")))), mdx(\"p\", null, \"Save and close the package.json, then create a package-lock.json using the same command as before:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"npm\"), \" i --package-lock-only\"))), mdx(\"p\", null, \"The subscriber needs one extra file that the publisher doesn't, and that's a file we'll call\\n\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"wait-for-it.js\"), \". Create the file and add the following:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"js\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-js\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-js\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" kafka \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"require\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'kafka-node'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" client \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"new\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token class-name\"\n  }, \"kafka\", mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"KafkaClient\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n  kafkaHost\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \"\\n    process\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"env\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token constant\"\n  }, \"ENVIRONMENT\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"===\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'local'\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"?\"), \" process\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"env\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token constant\"\n  }, \"INTERNAL_KAFKA_ADDR\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" process\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"env\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token constant\"\n  }, \"EXTERNAL_KAFKA_ADDR\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" Admin \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"Admin\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" child_process \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"require\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'child_process'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" admin \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"new\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token class-name\"\n  }, \"Admin\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), \"client\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"const\"), \" interval_id \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"setInterval\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=>\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n  admin\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"listTopics\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token parameter\"\n  }, \"err\", mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" res\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=>\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"if\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), \"res\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"[\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"1\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"]\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"metadata\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"[\"), \"process\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"env\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token constant\"\n  }, \"TOPIC\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"]\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n      console\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"log\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'Kafka topic created'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"clearInterval\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), \"interval_id\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n      child_process\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"execSync\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'npm start'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" stdio\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'inherit'\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"else\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n      console\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token function\"\n  }, \"log\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'Waiting for Kafka topic to be created'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"1000\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \";\")))), mdx(\"p\", null, \"This file will be used in the Docker container to ensure that the consumer doesn't attempt to\\nconsume messages from the topic before the topic has been created. Each second, it will check\\nwhether the topic exists, and when Kafka has started, and the topic is finally created, the\\nsubscriber will start. Last, create the Dockerfile in the \\\"subscriber\\\" folder with the following\\nsnippet:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"docker\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-docker\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-docker\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"FROM\"), \" node:12-alpine\"), \"\\n\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"WORKDIR\"), \" /usr/src/app\"), \"\\n\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"COPY\"), \" package*.json ./\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"RUN\"), \" npm install\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"COPY\"), \" . .\"), \"\\n\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"CMD\"), \" [ \", mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token string\"\n  }, \"\\\"node\\\"\"), \", \", mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token string\"\n  }, \"\\\"wait-for-it.js\\\"\"), \" ]\")))), mdx(\"p\", null, \"The subscriber's Dockerfile is the same as the publisher's, with the one difference noted above. The\\ncommand that starts the container uses the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"wait-for-it.js\"), \" file rather than the index. Save and\\nclose the Dockerfile.\"), mdx(\"h2\", {\n    \"id\": \"the-docker-compose-file-for-the-kafka-stack\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"The docker-compose file for the Kafka stack\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#the-docker-compose-file-for-the-kafka-stack\",\n    \"aria-label\": \"the docker compose file for the kafka stack permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"docker-compose\"), \" file is where the publisher, subscriber, Kafka, and\\n\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://zookeeper.apache.org/\"\n  }, \"Zookeeper\"), \" services will be tied together. Zookeeper is a service\\nthat is used to synchronize Kafka nodes within a cluster. Zookeeper deserves a post all of its own,\\nand because we only need one node in this tutorial I won't be going in-depth on it here. In the root\\nof the project alongside the \\\"subscriber\\\" and \\\"publisher\\\" folders, create a file called\\n\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"docker-compose.yml\"), \" and add this configuration:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"yml\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-yml\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-yml\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"version\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'3'\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"services\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"zookeeper\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ports\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'50000:2181'\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"image\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" jplock/zookeeper\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"kafka\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ports\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'50001:9092'\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'50002:9093'\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"depends_on\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" zookeeper\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"environment\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_ZOOKEEPER_CONNECT\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'zookeeper:2181'\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_LISTENERS\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'INTERNAL://:9092'\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_ADVERTISED_LISTENERS\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'INTERNAL://:9092'\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_LISTENER_SECURITY_PROTOCOL_MAP\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'INTERNAL:PLAINTEXT'\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_INTER_BROKER_LISTENER_NAME\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" INTERNAL\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'1'\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_CREATE_TOPICS\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'example-topic:1:1'\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_ADVERTISED_HOST_NAME\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" host.docker.internal \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token comment\"\n  }, \"# change to 172.17.0.1 if running on Ubuntu\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"image\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'wurstmeister/kafka:2.12-2.4.0'\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"volumes\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'/var/run/docker.sock:/var/run/docker.sock'\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"publisher\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"depends_on\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" kafka\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"environment\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"TOPIC\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"topic\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ENVIRONMENT\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" local\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"INTERNAL_KAFKA_ADDR\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'kafka:9092'\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"build\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"context\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" ./publisher\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"subscriber\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"depends_on\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" kafka\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"environment\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"TOPIC\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"topic\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ENVIRONMENT\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" local\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"INTERNAL_KAFKA_ADDR\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'kafka:9092'\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"build\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"context\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" ./subscriber\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"volumes\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\")))), mdx(\"p\", null, \"Note that the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"services\"), \" block of the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"docker-compose\"), \" contains four keys under which we define\\nspecific properties for each service. Below is a service-by-service walkthrough of what each\\nproperty and its sub-properties are used for.\"), mdx(\"h3\", {\n    \"id\": \"zookeeper\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Zookeeper\", mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#zookeeper\",\n    \"aria-label\": \"zookeeper permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"ports\"), \" property instructs Zookeeper to expose itself to Kafka on port 2181 inside of the Docker\\nnetwork. Zookeeper is also available to the host machine on port 50000. The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"image\"), \" property\\ninstructs the Docker daemon to pull the latest version of the image\\njplock/zookeeper](\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://hub.docker.com/r/jplock/zookeeper\"\n  }, \"https://hub.docker.com/r/jplock/zookeeper\"), \").\"), mdx(\"h3\", {\n    \"id\": \"kafka\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Kafka\", mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#kafka\",\n    \"aria-label\": \"kafka permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"kafka\"), \" service block includes configuration that will be passed to Kafka running inside of the\\ncontainer, among other properties that will enable communication between the Kafka service and other\\ncontainers.\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"ports\"), \" - Kafka exposes itself on two ports internal to the Docker network, 9092 and 9093. It is\\nalso exposed to the host machine on ports 50001 and 50002.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"depends_on\"), \" - Kafka depends on Zookeeper to run, so its key is included in the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"depends_on\"), \" block\\nto ensure that Docker will start Zookeeper before Kafka.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"environment\"), \" - Kafka will pick up the environment variables in this block once the container\\nstarts. All configuration options except for \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"KAFKA_CREATE_TOPICS\"), \" will be added to a Kafka broker\\nconfig and applied on startup. The variable \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"KAFKA_CREATE_TOPICS\"), \" is used by the Docker image\\nitself, not Kafka, to make working with Kafka easier. Topics defined by this variable will be\\ncreated when Kafka starts without any external instructions.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"image\"), \" - This field instructs the Docker daemon to pull version 2.12-2.4.0 of the image\\n\", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://hub.docker.com/r/wurstmeister/kafka/\"\n  }, \"wurstmeister/kafka \"), \".\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"volumes\"), \" - This is a requirement by the Docker image to use the Docker CLI when starting Kafka\\nlocally.\")), mdx(\"h3\", {\n    \"id\": \"publisher\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Publisher\", mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#publisher\",\n    \"aria-label\": \"publisher permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"Most configuration in the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"publisher\"), \" block specifies how the publisher should communicate with\\nKafka. Note that the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"depends_on\"), \" property ensures that the publisher will start after Kafka.\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"depends_on\"), \" - The publisher service naturally depends on Kafka, so it's included in the\\ndependency array.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"environment\"), \" - These variables are used by the code in the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"index.js\"), \" of the publisher.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"TOPIC\"), \" - This is the topic that messages will be published to. Note that it matches the topic\\nthat will be created by the Kafka container.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"ENVIRONMENT\"), \" - This environment variable determines inside the index file on what port the\\nservice will communicate with Kafka. The ternary statement that it is used in exists to use the\\nsame code for both local and remote deployments.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"INTERNAL_KAFKA_ADDR\"), \" - The publisher will connect to Kafka on this host and port.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"build\"), \" - The context inside tells the Docker daemon where to locate the Dockerfile that describes\\nhow the service will be built and run, along with supporting code and other files that will be\\nused inside of the container.\")), mdx(\"h3\", {\n    \"id\": \"subscriber\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Subscriber\", mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#subscriber\",\n    \"aria-label\": \"subscriber permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"Most of the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"docker-compose\"), \" configuration for the subscriber service is identical to that of the\\npublisher service. The one difference is that the context tells the Docker daemon to build from the\\n\\\"subscriber\\\" directory, where its Dockerfile and supporting files were created.\"), mdx(\"h3\", {\n    \"id\": \"run-the-example-stack\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Run the example stack\", mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#run-the-example-stack\",\n    \"aria-label\": \"run the example stack permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"Finally, the moment we've all been waiting for, running the services! All that's needed now is to\\nrun the command below from the root directory of the project:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"docker-compose up\"))), mdx(\"p\", null, \"That's it! Once all of the services start up and the Kafka topic is created, the output from the\\npublisher and subscriber services will look like this:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"text\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-text\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-text\"\n  }, \"publisher_1   | { 'example-topic': { '0': 0 } }\\nsubscriber_1  | Kafka topic created\\nsubscriber_1  |\\nsubscriber_1  | > @architect-examples/event-subscriber@0.1.0 start /usr/src/app\\nsubscriber_1  | > node index.js\\nsubscriber_1  |\\nsubscriber_1  | {\\nsubscriber_1  |   topic: 'example-topic',\\nsubscriber_1  |   value: 'example-topic_message_1610477237480',\\nsubscriber_1  |   offset: 0,\\nsubscriber_1  |   partition: 0,\\nsubscriber_1  |   highWaterOffset: 1,\\nsubscriber_1  |   key: null\\nsubscriber_1  | }\\nsubscriber_1  | {\\nsubscriber_1  |   topic: 'example-topic',\\nsubscriber_1  |   value: 'example-topic_message_1610477242483',\\nsubscriber_1  |   offset: 1,\\nsubscriber_1  |   partition: 0,\\nsubscriber_1  |   highWaterOffset: 2,\\nsubscriber_1  |   key: null\\nsubscriber_1  | }\\npublisher_1   | { 'example-topic': { '0': 1 } }\"))), mdx(\"p\", null, \"New messages will continue to be published and consumed until the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"docker-compose\"), \" process is\\nstopped by pressing \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"ctrl/cmd+C\"), \" in the same terminal that it was started in.\"), mdx(\"h2\", {\n    \"id\": \"run-kafka-in-the-cloud-on-kubernetes\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Run Kafka in the cloud on Kubernetes\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#run-kafka-in-the-cloud-on-kubernetes\",\n    \"aria-label\": \"run kafka in the cloud on kubernetes permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"Running Kafka locally can be useful for testing and iterating, but where it's most useful is of\\ncourse, the cloud. This section of the tutorial will guide you through deploying the same\\napplication that was just deployed locally to your Kubernetes cluster. Note that most services\\ncharge some amount of money by default for running a Kubernetes cluster, though occasionally you can\\nget free credits when you sign up. For the most straightforward setup of a cluster, you can run your\\nKubernetes cluster with \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://www.digitalocean.com/\"\n  }, \"Digital Ocean\"), \". For the cluster to pull the\\nDocker images that you will be building, a \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://hub.docker.com/\"\n  }, \"Docker Hub\"), \" account will be\\nuseful, where you can host multiple free repositories. The same code and Docker images will be used\\nfrom the previous part of the tutorial.\"), mdx(\"h3\", {\n    \"id\": \"build-and-push-the-images-to-docker-hub\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Build and push the images to Docker Hub\", mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#build-and-push-the-images-to-docker-hub\",\n    \"aria-label\": \"build and push the images to docker hub permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"For the Kubernetes cluster to pull the Docker images, they'll need to be pushed to a repository in\\nthe cloud where they can be accessed. Docker Hub is the most frequently used cloud-hosted\\nrepository, and the images here will be made public for ease of use in this tutorial. To start, be\\nsure that you have a Docker Hub account, then enter the following in a terminal:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"docker login\"))), mdx(\"p\", null, \"Enter your Docker Hub username (not email) and password when prompted. You should see the message\\n\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Login Succeeded\"), \", which indicates that you've successfully logged in to Docker Hub in the terminal.\\nThe next step is to push the images that will need to be used in the Kubernetes cluster. From the\\nroot of the project, navigate to the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"publisher\"), \" directory and build and tag the publisher service\\nwith the following command:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"docker build \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token builtin class-name\"\n  }, \".\"), \" -t \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"<\"), \"your_docker_hub_username\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \">\"), \"/publisher:latest\"))), mdx(\"p\", null, \"Your local machine now has a Docker image tagged as \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"<your_docker_hub_username>/publisher:latest\"), \",\\nwhich can be pushed to the cloud. You might have also noticed that the build was faster than the\\nfirst time the publisher was built. This is because Docker caches image layers locally, and if you\\ndidn't change anything in the publisher service, it doesn't need to be rebuilt completely. Now, push\\nthe tagged image with the command:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"docker push \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"<\"), \"your_docker_hub_username\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \">\"), \"/publisher:latest\"))), mdx(\"p\", null, \"Your custom image is now hosted publicly on the internet! Navigate to\\n\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://hub.docker.com/repository/docker/\"\n  }, \"https://hub.docker.com/repository/docker/\"), \"<your_docker_hub_username>/publisher and log in if you'd\\nlike to view it. Now, navigate to the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"subscriber\"), \" folder and do the same for the subscriber service\\nwith two similar commands:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"docker build \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token builtin class-name\"\n  }, \".\"), \" -t \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"<\"), \"your_docker_hub_username\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \">\"), \"/subscriber:latest\\ndocker push \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"<\"), \"your_docker_hub_username\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \">\"), \"/subscriber:latest\"))), mdx(\"p\", null, \"All of the images needed to run the stack on a Kubernetes cluster should now be available publicly.\\nFortunately, Kafka and Zookeeper didn't need to be pushed anywhere, as the images are already\\npublic.\"), mdx(\"h3\", {\n    \"id\": \"deploy-the-stack-to-kubernetes\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Deploy the stack to Kubernetes\", mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#deploy-the-stack-to-kubernetes\",\n    \"aria-label\": \"deploy the stack to kubernetes permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"Once you have a Kubernetes cluster created on Digital Ocean or wherever you prefer, and you've\\ndownloaded the cluster's \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"kubeconfig\"), \" or set your Kubernetes context, you're ready to deploy the\\npublisher, consumer, Kafka, and Zookeeper. Be sure that the cluster also has the Kubernetes\\ndashboard installed. On Digital Ocean, the dashboard will be preinstalled.\"), mdx(\"p\", null, \"Deploying to Kubernetes in the next steps will also require the Kubernetes CLI, \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"kubectl\"), \" to be\\ninstalled to your local machine. Once the prerequisites are complete, the next steps will be\\ncreating and deploying Kubernetes manifests. These manifests will be for a\\n\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/\"\n  }, \"namespace\"), \",\\n\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://kubernetes.io/docs/concepts/workloads/controllers/deployment/\"\n  }, \"deployments\"), \", and\\n\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://kubernetes.io/docs/concepts/services-networking/service/\"\n  }, \"services\"), \". In the root of the\\nproject, create a directory called \\\"kubernetes\\\" and navigate to that directory. For organization,\\nall manifests will be created here. Start by creating a file called namespace.yml. Within\\nKubernetes, the namespace will group all of the resources created in this tutorial.\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"yml\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-yml\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-yml\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"apiVersion\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" v1\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"kind\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" Namespace\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"metadata\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"example\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"labels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"example\"))), mdx(\"p\", null, \"Save and close the file. To create the namespace within the Kubernetes cluster, kubectl will be\\nused. Run the command below:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"kubectl create -f namespace.yml --kubeconfig\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"<\"), \"kubeconfig_file_for_your_cluster\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \">\")))), mdx(\"p\", null, \"If the namespace was created successfully, the message \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"namespace/kafka-example created\"), \" will be\\nprinted to the console.\"), mdx(\"p\", null, \"Before deployments are created, Kubernetes services are required to allow traffic to the pods that\\nothers depend on. To do this, two services will be created. One will allow traffic to the Kafka pod\\non its exposed ports, 9092 and 9093, and the other will allow traffic to the Zookeeper pod on its\\nexposed port, 2181. These will allow the publisher and subscriber to send traffic to Kafka and Kafka\\nto send traffic to Zookeeper, respectively. Still in the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"k8s\"), \" directory, start by creating a file\\ncalled \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"kafka-service.yml\"), \" with the following \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"yml\"), \":\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"yml\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-yml\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-yml\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"kind\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" Service\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"apiVersion\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" v1\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"metadata\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"kafka\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"namespace\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"example\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"labels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"kafka\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"spec\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ports\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" external\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"protocol\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" TCP\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"port\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9093\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"targetPort\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9093\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" internal\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"protocol\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" TCP\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"port\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9092\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"targetPort\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9092\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"selector\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"kafka\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"type\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" ClusterIP\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"sessionAffinity\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" None\"))), mdx(\"p\", null, \"Create the service in the cluster by running the command below:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"kubectl create -f kafka-service.yml --kubeconfig\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"<\"), \"kubeconfig_file_for_your_cluster\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \">\")))), mdx(\"p\", null, \"kubectl should confirm that the service has been created. Now, create the other service by first\\ncreating a file called \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"zookeeper-service.yml\"), \". Add the following contents to that file:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"yml\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-yml\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-yml\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"kind\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" Service\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"apiVersion\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" v1\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"metadata\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"zookeeper\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"namespace\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"example\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"labels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"zookeeper\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"spec\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ports\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" main\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"protocol\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" TCP\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"port\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"2181\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"targetPort\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"2181\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"selector\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"zookeeper\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"type\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" ClusterIP\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"sessionAffinity\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" None\"))), mdx(\"p\", null, \"Create the service within the cluster with the command:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"kubectl create -f zookeeper-service.yml --kubeconfig\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"<\"), \"kubeconfig_file_for_your_cluster\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \">\")))), mdx(\"p\", null, \"Next, four deployments will need to be created inside the new namespace, one for each service. Start\\nby creating a file called \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"zookeeper-deployment.yml\"), \" and add the following \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"yml\"), \":\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"yml\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-yml\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-yml\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"kind\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" Deployment\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"apiVersion\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" apps/v1\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"metadata\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"zookeeper\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"namespace\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"example\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"labels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"zookeeper\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"spec\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"replicas\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"1\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"selector\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"matchLabels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"zookeeper\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"template\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"metadata\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"labels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"zookeeper\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"spec\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"containers\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"zookeeper\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"image\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" jplock/zookeeper\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ports\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"containerPort\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"2181\"), \"\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"protocol\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" TCP\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"imagePullPolicy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" IfNotPresent\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"restartPolicy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" Always\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"dnsPolicy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" ClusterFirst\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"schedulerName\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" default\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"scheduler\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"enableServiceLinks\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token boolean important\"\n  }, \"true\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"strategy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"type\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" RollingUpdate\"))), mdx(\"p\", null, \"Save the contents and run the command below to create the deployment in the kafka-example namespace:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"kubectl create -f zookeeper-deployment.yml --kubeconfig\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"<\"), \"kubeconfig_file_for_your_cluster\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \">\")))), mdx(\"p\", null, \"When the deployment has been created successfully, \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"deployment.apps/example-zookeeper created\"), \" will\\nbe printed. The next step will be creating and deploying the manifest for Kafka. Create the file\\n\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"kafka-deployment.yml\"), \" and add:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"yml\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-yml\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-yml\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"kind\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" Deployment\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"apiVersion\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" apps/v1\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"metadata\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"kafka\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"namespace\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"example\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"labels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"kafka\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"spec\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"replicas\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"1\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"selector\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"matchLabels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"kafka\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"template\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"metadata\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"labels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"kafka\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"spec\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"containers\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"kafka\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"image\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'wurstmeister/kafka:2.12-2.4.0'\"), \"\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ports\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"containerPort\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9093\"), \"\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"protocol\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" TCP\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"containerPort\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9092\"), \"\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"protocol\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" TCP\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"env\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" KAFKA_ADVERTISED_LISTENERS\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"value\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" INTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"//\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9092\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"EXTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"//example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"kafka.kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"example.svc.cluster.local\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9093\"), \"\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" KAFKA_CREATE_TOPICS\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"value\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"topic\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"1\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"1\"), \"\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" KAFKA_INTER_BROKER_LISTENER_NAME\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"value\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" INTERNAL\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" KAFKA_LISTENERS\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"value\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" INTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"//\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9092\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"EXTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"//\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9093\"), \"\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" KAFKA_LISTENER_SECURITY_PROTOCOL_MAP\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"value\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" INTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"PLAINTEXT\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"EXTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"PLAINTEXT\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"value\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'1'\"), \"\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" KAFKA_ZOOKEEPER_CONNECT\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"value\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"zookeeper.kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"example.svc.cluster.local\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"2181\"), \"\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"imagePullPolicy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" IfNotPresent\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"restartPolicy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" Always\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"dnsPolicy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" ClusterFirst\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"schedulerName\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" default\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"scheduler\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"enableServiceLinks\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token boolean important\"\n  }, \"true\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"strategy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"type\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" RollingUpdate\"))), mdx(\"p\", null, \"Save and close the file. Similar to the Zookeeper deployment, run the command below in a terminal:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"kubectl create -f kafka-deployment.yml --kubeconfig\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"<\"), \"kubeconfig_file_for_your_cluster\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \">\")))), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"deployment.apps/example-kafka created\"), \" should have been printed to the console. The last two\\ndeployments to be created will be the subscriber and publisher services. Create\\n\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"publisher-deployment.yml\"), \" with the contents and be sure to replace \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"<your_docker_hub_username>\"), \"\\nwith your own username:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"yml\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-yml\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-yml\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"kind\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" Deployment\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"apiVersion\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" apps/v1\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"metadata\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"publisher\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"namespace\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"example\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"labels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"publisher\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"spec\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"replicas\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"1\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"selector\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"matchLabels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"publisher\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"template\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"metadata\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"labels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"publisher\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"spec\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"containers\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"publisher\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"image\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'<your_docker_hub_username>/publisher:latest'\"), \"\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"imagePullPolicy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" Always\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"env\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" ENVIRONMENT\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"value\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" prod\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" EXTERNAL_KAFKA_ADDR\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"value\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"kafka.kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"example.svc.cluster.local\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9093\"), \"\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" TOPIC\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"value\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"topic\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"restartPolicy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" Always\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"dnsPolicy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" ClusterFirst\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"schedulerName\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" default\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"scheduler\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"enableServiceLinks\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token boolean important\"\n  }, \"true\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"strategy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"type\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" RollingUpdate\"))), mdx(\"p\", null, \"Run \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"kubectl create -f publisher-deployment.yml --kubeconfig=<kubeconfig_file_for_your_cluster>\"), \" to\\ncreate the deployment for the publisher and make sure that kubectl prints a message letting you know\\nthat it's been created. The last deployment to create is the subscriber, which will be created in\\nthe same way as the other services. Create the file \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"subscriber-deployment.yml\"), \" and add the\\nfollowing configuration, being sure to replace \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"<your_docker_hub_username>\"), \":\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"yml\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-yml\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-yml\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"kind\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" Deployment\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"apiVersion\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" apps/v1\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"metadata\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"subscriber\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"namespace\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"example\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"labels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"subscriber\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"spec\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"replicas\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"1\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"selector\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"matchLabels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"subscriber\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"template\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"metadata\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"labels\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"app\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"subscriber\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"spec\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"containers\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"subscriber\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"image\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'<your_docker_hub_username>/subscriber:latest'\"), \"\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"imagePullPolicy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" Always\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"env\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" ENVIRONMENT\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"value\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" prod\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" EXTERNAL_KAFKA_ADDR\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"value\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"kafka.kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"example.svc.cluster.local\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9093\"), \"\\n            \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" TOPIC\\n              \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"value\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" example\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"topic\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"restartPolicy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" Always\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"dnsPolicy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" ClusterFirst\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"schedulerName\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" default\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"scheduler\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"enableServiceLinks\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token boolean important\"\n  }, \"true\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"strategy\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"type\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" RollingUpdate\"))), mdx(\"p\", null, \"For the last of the deployments, create the subscriber by running\\n\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"kubectl create -f subscriber-deployment.yml --kubeconfig=<kubeconfig_file_for_your_cluster>\"), \". If\\nyou now navigate to the Kubernetes dashboard for your cluster, you should see that all four\\ndeployments have been created, which have in turn created four pods. Each pod runs the container\\nreferred to by the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"image\"), \" field in its respective deployment.\"), mdx(\"p\", null, \"Wait for a success message to print to the console. Now that all required services and deployments\\nare created feel free to navigate to the Kubernetes dashboard to view the running pods. Navigate to\\nthe running example-subscriber pod and view the logs to see that it's consuming messages from the\\ntopic.\"), mdx(\"p\", null, \"If you\\u2019re satisfied with your work and want to destroy all of the Kubernetes resources that you just\\ncreated, use the following command to clean up:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"kubectl delete namespace kafka-example --kubeconfig\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"<\"), \"kubeconfig_file_for_your_cluster\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \">\")))), mdx(\"p\", null, \"Whew! That was a little complicated and took quite a few commands and files to run. What if\\neverything that was done could be compressed into a single, short file? What if the entire stack\\ncould be created in Kubernetes with a single command? Continue to find out how easy deploying a\\nKafka-centric stack both locally and on Kubernetes can be.\"), mdx(\"h2\", {\n    \"id\": \"run-kafka-locally-with-architect\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Run Kafka locally with Architect\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#run-kafka-locally-with-architect\",\n    \"aria-label\": \"run kafka locally with architect permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"The Architect platform can dramatically simplify deployments of any architecture to both local and\\ncloud environments. Just define a component in a single file representing the services that should\\nbe deployed, and that component can be deployed anywhere. The Kafka example which you just ran\\nlocally can be defined in the following manner as an Architect component:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"yml\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-yml\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-yml\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" examples/kafka\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"homepage\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" https\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"//github.com/architect\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"team/architect\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"cli/tree/master/examples/kafka\\n\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"services\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"zookeeper\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"image\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" jplock/zookeeper\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"interfaces\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"main\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"2181\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"kafka\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"image\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" wurstmeister/kafka\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"2.12\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"2.4.0\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"interfaces\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"internal\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9092\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"external\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9093\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"environment\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_ZOOKEEPER_CONNECT\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        $\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.zookeeper.interfaces.main.host \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"$\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.zookeeper.interfaces.main.port\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_LISTENERS\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        INTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"//\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"$\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.kafka.interfaces.internal.port \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"EXTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"//\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"$\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n        services.kafka.interfaces.external.port \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_ADVERTISED_LISTENERS\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        INTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"//\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9092\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"EXTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"//$\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.kafka.interfaces.external.host \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"$\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n        services.kafka.interfaces.external.port \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_LISTENER_SECURITY_PROTOCOL_MAP\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" INTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"PLAINTEXT\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"EXTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"PLAINTEXT\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_INTER_BROKER_LISTENER_NAME\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" INTERNAL\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"1\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_CREATE_TOPICS\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" architect\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"1\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"1\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"debug\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"volumes\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"docker\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"mount_path\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" /var/run/docker.sock\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"host_path\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" /var/run/docker.sock\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"environment\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_ADVERTISED_HOST_NAME\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" host.docker.internal \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token comment\"\n  }, \"# change to 172.17.0.1 if running on Ubuntu\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_LISTENERS\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" INTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"//\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9092\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_ADVERTISED_LISTENERS\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" INTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"//\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"9092\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"KAFKA_LISTENER_SECURITY_PROTOCOL_MAP\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" INTERNAL\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"PLAINTEXT\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"publisher\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"build\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"context\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" ./publisher/\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"interfaces\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"environment\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"EXTERNAL_KAFKA_ADDR\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        $\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.kafka.interfaces.external.host \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"$\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.kafka.interfaces.external.port\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"TOPIC\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" architect\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ENVIRONMENT\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" prod\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"debug\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"environment\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"INTERNAL_KAFKA_ADDR\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n          $\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.kafka.interfaces.internal.host \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"$\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.kafka.interfaces.internal.port\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ENVIRONMENT\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" local\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"subscriber\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"build\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"context\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" ./subscriber/\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"interfaces\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"environment\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"EXTERNAL_KAFKA_ADDR\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        $\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.kafka.interfaces.external.host \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"$\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.kafka.interfaces.external.port\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"TOPIC\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" architect\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ENVIRONMENT\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" prod\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"debug\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"environment\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"INTERNAL_KAFKA_ADDR\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n          $\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.kafka.interfaces.internal.host \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"$\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.kafka.interfaces.internal.port\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ENVIRONMENT\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" local\"))), mdx(\"p\", null, \"Copy and paste the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"yml\"), \" above into a file called \\\"architect.yml\\\" in the project\\u2019s root directory.\\nTo run the Kafka component locally, run the command below in the project's root directory:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"architect dev architect.yml\"))), mdx(\"p\", null, \"The same information should be printed to the console as when the stack was run directly with\\ndocker-compose. When you're ready, press Ctrl/Cmd+C to stop the running application. As mentioned\\nbefore, an Architect component can be deployed both locally and to any cloud environment. Click the\\nbutton below to deploy the Kafka example component to Architect's hosted cloud service.\"), mdx(\"p\", null, mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://cloud.architect.io/examples/components/kafka/deploy?tag=latest\"\n  }, mdx(\"img\", {\n    parentName: \"a\",\n    \"src\": \"https://www.architect.io/deploy-button.svg\",\n    \"alt\": \"Deploy Button\"\n  }))), mdx(\"p\", null, \"A few clicks, and that's it! The same stack that could be run locally is running in a Kubernetes\\ncluster in the cloud. If you would like to explore more, feel free to register your own cluster as a\\nplatform with the Architect Cloud!\"), mdx(\"h2\", {\n    \"id\": \"learn-more-about-safe-fast-deployments-with-docker-and-architect\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Learn more about safe, fast deployments with Docker and Architect\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#learn-more-about-safe-fast-deployments-with-docker-and-architect\",\n    \"aria-label\": \"learn more about safe fast deployments with docker and architect permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"Kafka is a powerful yet complicated application that takes careful configuration to get running\\nproperly. Fortunately, there are a few robust tools like docker-compose and Architect to enable\\nsmooth deployments locally and in the cloud. If you'd like to understand more about how Architect\\ncan help you expedite both local and remote deployments, check out the\\n\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://www.architect.io/docs/\"\n  }, \"docs\"), \" and \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://cloud.architect.io/signup\"\n  }, \"sign up\"), \"!\"), mdx(\"p\", null, \"For more reading, check out some of our other tutorials!\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://www.architect.io/blog/rabbitmq-docker-tutorial\"\n  }, \"Implement RabbitMQ on Docker in 20 Minutes\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://www.architect.io/blog/django-docker-tutorial\"\n  }, \"Deploy your Django app with Docker\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://www.architect.io/blog/gitops-developers-guide\"\n  }, \"A Developer\\u2019s Guide to GitOps\"))), mdx(\"p\", null, \"If you have any questions or comments, don\\u2019t hesitate to reach out to the team on Twitter\\n\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://twitter.com/architect_team\"\n  }, \"@architect_team\"), \"!\"));\n}\n;\nMDXContent.isMDXComponent = true;","excerpt":"Apache Kafka is a high-throughput, high-availability, and scalable solution chosen by the world's\ntop companies for uses such as event streaming, stream processing, log aggregation, and more. Kafka…","tableOfContents":{"items":[{"url":"#project-dependencies-for-kafka-and-docker","title":"Project dependencies for Kafka and Docker"},{"url":"#build-the-publisher-service-in-node-for-kafka-with-docker","title":"Build the publisher service in Node for Kafka with Docker"},{"url":"#build-the-subscriber-service-for-kafka-with-docker","title":"Build the subscriber service for Kafka with Docker"},{"url":"#the-docker-compose-file-for-the-kafka-stack","title":"The docker-compose file for the Kafka stack","items":[{"url":"#zookeeper","title":"Zookeeper"},{"url":"#kafka","title":"Kafka"},{"url":"#publisher","title":"Publisher"},{"url":"#subscriber","title":"Subscriber"},{"url":"#run-the-example-stack","title":"Run the example stack"}]},{"url":"#run-kafka-in-the-cloud-on-kubernetes","title":"Run Kafka in the cloud on Kubernetes","items":[{"url":"#build-and-push-the-images-to-docker-hub","title":"Build and push the images to Docker Hub"},{"url":"#deploy-the-stack-to-kubernetes","title":"Deploy the stack to Kubernetes"}]},{"url":"#run-kafka-locally-with-architect","title":"Run Kafka locally with Architect"},{"url":"#learn-more-about-safe-fast-deployments-with-docker-and-architect","title":"Learn more about safe, fast deployments with Docker and Architect"}]},"frontmatter":{"title":"Get Started with Kafka and Docker in 20 Minutes","description":"Follow this tutorial to deploy and connect to a Kafka service to broker communication between Dockerized Node.js microservices.","author":"Ryan Cahill","date":"2021-01-26","image":{"childImageSharp":{"gatsbyImageData":{"layout":"constrained","images":{"fallback":{"src":"/static/8d525b151fd713fbb0f4486e23ac2e69/7a23e/kafka-docker.png","srcSet":"/static/8d525b151fd713fbb0f4486e23ac2e69/4ca58/kafka-docker.png 250w,\n/static/8d525b151fd713fbb0f4486e23ac2e69/0251a/kafka-docker.png 500w,\n/static/8d525b151fd713fbb0f4486e23ac2e69/7a23e/kafka-docker.png 1000w","sizes":"(min-width: 1000px) 1000px, 100vw"},"sources":[{"srcSet":"/static/8d525b151fd713fbb0f4486e23ac2e69/002ed/kafka-docker.webp 250w,\n/static/8d525b151fd713fbb0f4486e23ac2e69/15bdf/kafka-docker.webp 500w,\n/static/8d525b151fd713fbb0f4486e23ac2e69/27c85/kafka-docker.webp 1000w","type":"image/webp","sizes":"(min-width: 1000px) 1000px, 100vw"}]},"width":1000,"height":563}}}}},"next":null,"previous":null}]}},"pageContext":{"slug":"kafka-docker-tutorial"}},
    "staticQueryHashes": ["764694655"]}