Question

How to setup kafka through pulumi on kubernetes cluster

Hi, I’ve followed simple tutorial for creating K8S cluster on DO with Pulumi, but now I like to configure kafka provider from Pulumi on to the same cluster previously created.

I’m not sure how to achieve and if is possible to do it in simple manner, without extra scripts or manual editing of different kafka files.

So far, I have this code:


const kafkaProvider = new kafka.Provider(kafkaProviderName, {
  bootstrapServers: ["x.x.x.x:9092"],
}, { provider: kubernetesProvider });

export const topic = new kafka.Topic('demo-topic', {
  replicationFactor: 1,
  partitions: 1,
}, { provider: kafkaProvider });

export { kafkaProvider };

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

The Kafka provider creates resources within an existing Kafka cluster. Your example would create a new Topic by connecting to a Kafka cluster on that given IP and port.

If I understand correctly, you have a clean K8s cluster without Kafka installed on it yet. If so, you need to define another set of resources to provision a Kafka cluster on your K8s cluster.

Unfortunately, I don’t have an ready-to-use example of a Kafka installation. I suspect you may want to use a Helm chart for that. If so, this example shows how to provision a Helm chart with Pulumi: https://github.com/pulumi/examples/tree/master/kubernetes-ts-helm-wordpress