NATS on Kubernetes example

Abhishek Gupta
1 min readMay 2, 2018

--

In a previous blog, you saw an example of NATS along with producer and consumer — based on Docker Compose. This post uses the same app, but runs on Kubernetes

For how to run, follow the README on Github

High level overview

The NATS Kubernetes operator is used here

  • it seeds a CRD
  • … using which we can spawn a NATS cluster on Kubernetes (with a single command!)
  • A Service object is created automatically – uses ClusterIP by default
NATS Kubernetes Service object

The environment variable corresponding to the Serviceis used in the application logic to locate NATS server. Note its usage here

Cheers!

Originally published at simplydistributed.wordpress.com on May 2, 2018.

--

--

Abhishek Gupta

Principal Developer Advocate at AWS | I ❤️ Databases, Go, Kubernetes